this.rank = rank;
this.location = location;
if (string.length() == 0) {
- this.string = " "; // workaround for setLineBackground has no effect on empty line //$NON-NLS-1$
+ /* workaround for setLineBackground has no effect on empty line */
+ this.string = " "; //$NON-NLS-1$
} else {
this.string = string;
}
fStyledText.addMouseMoveListener(this);
fStyledText.addMouseTrackListener(this);
fStyledText.addMouseWheelListener(this);
- fStyledText.addListener(SWT.MouseWheel, new Listener() { // disable mouse scroll of horizontal scroll bar
+ /* disable mouse scroll of horizontal scroll bar */
+ fStyledText.addListener(SWT.MouseWheel, new Listener() {
@Override
- public void handleEvent(Event event) { event.doit = false; }});
+ public void handleEvent(Event event) {
+ event.doit = false;
+ }
+ });
fStyledText.addKeyListener(this);
fTextArea.setBackground(fStyledText.getBackground());
@Override
public void mouseDown(MouseEvent e) {
fTextArea.setFocus();
- }});
+ }
+ });
}
// ------------------------------------------------------------------------
}
loadLineData();
fillTextArea();
- //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));
fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));
}
} else {
if (fLines.size() == 0) {
fSlider.setSelection(0);
} else {
- //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));
fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));
}
}
private void loadLineData() {
if (fTopLineIndex < 0) {
- //if (fLines.size() > 0 && fLines.get(0).rank > 0) {
- //long endRank = fLines.get(0).rank;
- //long startRank = Math.max(0, endRank - fNumVisibleLines);
- //TmfContext context = fTrace.seekEvent(startRank);
- //int index = 0;
- //while (context.getRank() < endRank) {
- //long rank = context.getRank();
- //ITmfLocation<?> location = context.getLocation();
- //TmfEvent event = fTrace.getNextEvent(context);
- //String[] lines = event.getRawText().split("\r?\n");
- //for (int i = 0; i < lines.length; i++) {
- //String line = lines[i];
- //LineData lineData = new LineData(rank, location, line);
- //fLines.add(index++, lineData);
- //fTopLineIndex++;
- //fLastTopLineIndex++;
- //}
- //}
- //}
if (fLines.size() > 0 && fTrace.getLocationRatio(fLines.get(0).location) > 0) {
double lastRatio = fTrace.getLocationRatio(fLines.get(fLines.size() - 1).location);
double firstRatio = fTrace.getLocationRatio(fLines.get(0).location);
if (fLines.size() == 0) {
fBottomContext = fTrace.seekEvent(0);
} else {
- //fBottomContext = fTrace.seekEvent(fLines.get(fLines.size() - 1).rank + 1);
fBottomContext = fTrace.seekEvent(fLines.get(fLines.size() - 1).location);
fTrace.getNext(fBottomContext);
}
/*
* The selection event was sent by the viewer, refresh now.
*/
- //long rank = (long) (fTrace.getNbEvents() * ((double) fSlider.getSelection() / SLIDER_MAX));
- //setTopRank(rank);
if (fSlider.getSelection() == 0 || fSlider.getThumb() == SLIDER_MAX) {
fLines.clear();
setTopPosition(0.0);
break;
}
case SWT.ARROW_UP: {
- //if (fLines.size() == 0 || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {
- if (fLines.size() == 0) {// || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {
+ if (fLines.size() == 0) {
break;
}
fTopLineIndex--;
break;
}
case SWT.HOME: {
- //selectAndReveal(0);
setTopPosition(0.0);
break;
}
case SWT.END: {
- //if (fTrace.getNbEvents() > 0) {
- //selectAndReveal(fTrace.getNbEvents() - 1);
- //}
double ratio = 1.0;
double delta = Math.pow(10, -15);
fLines.clear();
default:
break;
}
- //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));
if (e.detail != SWT.NONE) {
fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));
}
if (previousLineAtCaretPosition > 0) {
break;
}
- if (fLines.size() == 0) {// || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {
+ if (fLines.size() == 0) {
break;
}
fHoldSelection++;
if (previousCaretOffset > 0) {
break;
}
- if (fLines.size() == 0) {// || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {
+ if (fLines.size() == 0) {
break;
}
long topRank = fLines.get(fTopLineIndex).rank;
if ((e.stateMask & SWT.CTRL) == 0) {
break;
}
- //selectAndReveal(0);
setTopPosition(0.0);
LineData lineData = fLines.get(fTopLineIndex);
if (!lineData.location.equals(fSelectedLocation)) {
if ((e.stateMask & SWT.CTRL) == 0) {
break;
}
- //if (fTrace.getNbEvents() > 0) {
- //selectAndReveal(fTrace.getNbEvents() - 1);
- //}
double ratio = 1.0;
double delta = Math.pow(10, -15);
fLines.clear();
default:
break;
}
- //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));
updateHighlightedRank();
fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));
}
loadLineData();
updateTextArea();
fHoldSelection = 0;
- //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));
updateHighlightedRank();
fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));
}