+ } finally {
+ // Make sure that redraw is always enabled.
+ fTable.setRedraw(true);
+ }
+ fPackDone = true;
+ }
+
+
+ private void packMarginColumn() {
+ TableColumn[] columns = fTable.getColumns();
+ if (columns.length > 0) {
+ packSingleColumn(0, columns[0]);
+ }
+ }
+
+ private void packSingleColumn(int i, final TableColumn column) {
+ final int headerWidth = column.getWidth();
+ column.pack();
+ // Workaround for Linux which doesn't consider the image width of
+ // search/filter row in TableColumn.pack() after having executed
+ // TableItem.setImage((Image)null) for other rows than search/filter row.
+ boolean isCollapseFilter = fTable.getData(Key.FILTER_OBJ) instanceof TmfCollapseFilter;
+ if (IS_LINUX && (i == 0) && isCollapseFilter) {
+ column.setWidth(column.getWidth() + SEARCH_IMAGE.getBounds().width);
+ }
+
+ if (column.getWidth() < headerWidth) {
+ column.setWidth(headerWidth);
+ }
+ }
+
+ /**
+ * Get the array of item strings (e.g., what to display in each cell of the
+ * table row) corresponding to the columns and trace event passed in
+ * parameter. The order of the Strings in the returned array will correspond
+ * to the iteration order of 'columns'.
+ *
+ * <p>
+ * To ensure consistent results, make sure only call this within a scope
+ * synchronized on 'columns'! If the order of 'columns' changes right after
+ * this method is called, the returned value won't be ordered correctly
+ * anymore.
+ */
+ private static String[] getItemStrings(List<TmfEventTableColumn> columns, ITmfEvent event) {
+ if (event == null) {
+ return EMPTY_STRING_ARRAY;
+ }
+ synchronized (columns) {
+ List<String> itemStrings = new ArrayList<>(columns.size());
+ for (TmfEventTableColumn column : columns) {
+ ITmfEvent passedEvent = event;
+ if (!(column instanceof TmfMarginColumn) && (event instanceof CachedEvent)) {
+ // Make sure that the event object from the trace is passed
+ // to all columns but the TmfMarginColumn
+ passedEvent = ((CachedEvent) event).event;
+ }
+ if (passedEvent == null) {
+ itemStrings.add(EMPTY_STRING);
+ } else {
+ itemStrings.add(column.getItemString(passedEvent));
+ }