1 /*
   2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
   3  * 
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * The contents of this file are subject to the terms of either the Universal Permissive License
   7  * v 1.0 as shown at http://oss.oracle.com/licenses/upl
   8  *
   9  * or the following license:
  10  *
  11  * Redistribution and use in source and binary forms, with or without modification, are permitted
  12  * provided that the following conditions are met:
  13  * 
  14  * 1. Redistributions of source code must retain the above copyright notice, this list of conditions
  15  * and the following disclaimer.
  16  * 
  17  * 2. Redistributions in binary form must reproduce the above copyright notice, this list of
  18  * conditions and the following disclaimer in the documentation and/or other materials provided with
  19  * the distribution.
  20  * 
  21  * 3. Neither the name of the copyright holder nor the names of its contributors may be used to
  22  * endorse or promote products derived from this software without specific prior written permission.
  23  * 
  24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  26  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  27  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  30  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
  31  * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32  */
  33 package org.openjdk.jmc.flightrecorder.ext.jfx;
  34 
  35 import java.util.ArrayList;
  36 import java.util.Arrays;
  37 import java.util.List;
  38 import java.util.stream.Stream;
  39 
  40 import org.eclipse.jface.resource.ImageDescriptor;
  41 import org.eclipse.swt.SWT;
  42 import org.eclipse.swt.custom.SashForm;
  43 import org.eclipse.swt.graphics.Image;
  44 import org.eclipse.swt.widgets.Composite;
  45 import org.eclipse.ui.forms.widgets.Form;
  46 import org.eclipse.ui.forms.widgets.FormToolkit;
  47 import org.eclipse.ui.forms.widgets.Section;
  48 import org.eclipse.ui.plugin.AbstractUIPlugin;
  49 
  50 import org.openjdk.jmc.common.IState;
  51 import org.openjdk.jmc.common.IWritableState;
  52 import org.openjdk.jmc.common.item.Aggregators;
  53 import org.openjdk.jmc.common.item.IAggregator;
  54 import org.openjdk.jmc.common.item.IItemCollection;
  55 import org.openjdk.jmc.common.item.IItemFilter;
  56 import org.openjdk.jmc.common.unit.IQuantity;
  57 import org.openjdk.jmc.common.unit.IRange;
  58 import org.openjdk.jmc.flightrecorder.JfrAttributes;
  59 import org.openjdk.jmc.flightrecorder.ext.jfx.JfxVersionUtil.JavaFxEventAvailability;
  60 import org.openjdk.jmc.flightrecorder.ui.IDataPageFactory;
  61 import org.openjdk.jmc.flightrecorder.ui.IDisplayablePage;
  62 import org.openjdk.jmc.flightrecorder.ui.IPageContainer;
  63 import org.openjdk.jmc.flightrecorder.ui.IPageDefinition;
  64 import org.openjdk.jmc.flightrecorder.ui.IPageUI;
  65 import org.openjdk.jmc.flightrecorder.ui.ItemCollectionToolkit;
  66 import org.openjdk.jmc.flightrecorder.ui.StreamModel;
  67 import org.openjdk.jmc.flightrecorder.ui.common.AbstractDataPage;
  68 import org.openjdk.jmc.flightrecorder.ui.common.AggregationGrid;
  69 import org.openjdk.jmc.flightrecorder.ui.common.DataPageToolkit;
  70 import org.openjdk.jmc.flightrecorder.ui.common.FilterComponent;
  71 import org.openjdk.jmc.flightrecorder.ui.common.FlavorSelector;
  72 import org.openjdk.jmc.flightrecorder.ui.common.FlavorSelector.FlavorSelectorState;
  73 import org.openjdk.jmc.flightrecorder.ui.common.ItemHistogram;
  74 import org.openjdk.jmc.flightrecorder.ui.common.ItemHistogram.HistogramSelection;
  75 import org.openjdk.jmc.flightrecorder.ui.common.ItemHistogram.ItemHistogramBuilder;
  76 import org.openjdk.jmc.flightrecorder.ui.common.ItemList;
  77 import org.openjdk.jmc.flightrecorder.ui.common.ItemList.ItemListBuilder;
  78 import org.openjdk.jmc.flightrecorder.ui.common.ItemRow;
  79 import org.openjdk.jmc.flightrecorder.ui.selection.SelectionStoreActionToolkit;
  80 import org.openjdk.jmc.ui.charts.IXDataRenderer;
  81 import org.openjdk.jmc.ui.charts.RendererToolkit;
  82 import org.openjdk.jmc.ui.charts.XYChart;
  83 import org.openjdk.jmc.ui.column.ColumnManager.SelectionState;
  84 import org.openjdk.jmc.ui.column.ColumnMenusFactory;
  85 import org.openjdk.jmc.ui.column.TableSettings;
  86 import org.openjdk.jmc.ui.column.TableSettings.ColumnSettings;
  87 import org.openjdk.jmc.ui.handlers.MCContextMenuManager;
  88 import org.openjdk.jmc.ui.misc.ChartCanvas;
  89 import org.openjdk.jmc.ui.misc.CompositeToolkit;
  90 import org.openjdk.jmc.ui.misc.PersistableSashForm;
  91 
  92 public class JfxPage extends AbstractDataPage {
  93 
  94         public static class Factory implements IDataPageFactory {
  95                 @Override
  96                 public String getName(IState state) {
  97                         return Messages.JfxPage_JAVA_FX;
  98                 }
  99 
 100                 @Override
 101                 public ImageDescriptor getImageDescriptor(IState state) {
 102                         return AbstractUIPlugin.imageDescriptorFromPlugin("org.openjdk.jmc.flightrecorder.ext.jfx", //$NON-NLS-1$
 103                                         "icons/pulse.png"); //$NON-NLS-1$
 104                 }
 105 
 106                 @Override
 107                 public String[] getTopics(IState state) {
 108                         return new String[] {JfxConstants.JFX_RULE_PATH};
 109                 }
 110 
 111                 @Override
 112                 public IDisplayablePage createPage(IPageDefinition definition, StreamModel items, IPageContainer editor) {
 113                         return new JfxPage(definition, items, editor);
 114                 }
 115         }
 116 
 117         private static final ItemHistogramBuilder BY_PULSE_HISTOGRAM = new ItemHistogramBuilder();
 118         private static final ItemHistogramBuilder INPUT_HISTOGRAM = new ItemHistogramBuilder();
 119         private final ItemListBuilder phaseList = new ItemListBuilder();
 120 
 121         private static final String TOTAL_DURATION = "totalDuration"; //$NON-NLS-1$
 122         private static final String PULSE_START = "pulseStart"; //$NON-NLS-1$
 123 
 124         static {
 125                 BY_PULSE_HISTOGRAM.addCountColumn();
 126                 BY_PULSE_HISTOGRAM.addColumn(TOTAL_DURATION, Aggregators.sum(JfrAttributes.DURATION));
 127                 BY_PULSE_HISTOGRAM.addColumn(PULSE_START, JfxConstants.PULSE_START);
 128 
 129                 INPUT_HISTOGRAM.addCountColumn();
 130                 INPUT_HISTOGRAM.addColumn(TOTAL_DURATION, Aggregators.sum(JfrAttributes.DURATION));
 131         }
 132 
 133         private class JfxUI implements IPageUI {
 134 
 135                 private static final String PULSES_FILTER = "pulsesFilter"; //$NON-NLS-1$
 136                 private static final String PHASES_FILTER = "phasesFilter"; //$NON-NLS-1$
 137                 private static final String INPUT_FILTER = "inputFilter"; //$NON-NLS-1$
 138                 private final ChartCanvas chartCanvas;
 139                 private final ItemHistogram pulsesTable;
 140                 private final ItemHistogram inputTable;
 141                 private final ItemList phasesTable;
 142                 private IPageContainer pageContainer;
 143                 private final SashForm tableSash;
 144                 private final SashForm mainSash;
 145                 private final SashForm phasesSash;
 146                 private IItemCollection selectionItems;
 147                 private XYChart chart;
 148                 private IItemCollection phaseItems;
 149 
 150                 private static final String MAIN_SASH = "mainSash"; //$NON-NLS-1$
 151                 private static final String TABLE_SASH = "tableSash"; //$NON-NLS-1$
 152                 private static final String PHASES_SASH = "phasesSash"; //$NON-NLS-1$
 153                 private static final String PULSES_TABLE = "pulseTable"; //$NON-NLS-1$
 154                 private static final String PHASES_TABLE = "phaseTable"; //$NON-NLS-1$
 155                 private static final String INPUT_TABLE = "inputTable"; //$NON-NLS-1$
 156                 private final StreamModel items;
 157                 private IRange<IQuantity> currentRange;
 158                 private FlavorSelector flavorSelector;
 159                 private FilterComponent pulsesFilter;
 160                 private FilterComponent phasesFilter;
 161                 private FilterComponent inputFilter;
 162 
 163                 public JfxUI(Composite parent, FormToolkit toolkit, IPageContainer editor, IState state, StreamModel items,
 164                                 String name, Image icon) {
 165                         this.pageContainer = editor;
 166                         this.items = items;
 167                         Form form = DataPageToolkit.createForm(parent, toolkit, name, icon);
 168 
 169                         JavaFxEventAvailability availability = JfxVersionUtil.getAvailability(getItems());
 170                         
 171                         mainSash = new SashForm(form.getBody(), SWT.VERTICAL | SWT.SMOOTH);
 172                         toolkit.adapt(mainSash);
 173                         tableSash = new SashForm(mainSash, SWT.HORIZONTAL | SWT.SMOOTH);
 174                         toolkit.adapt(tableSash);
 175 
 176                         Section phases = CompositeToolkit.createSection(tableSash, toolkit, Messages.JfxPage_PHASES);
 177                         phasesSash = new SashForm(phases, SWT.HORIZONTAL | SWT.SMOOTH);
 178                         phases.setClient(phasesSash);
 179                         pulsesTable = BY_PULSE_HISTOGRAM.buildWithoutBorder(phasesSash, JfxVersionUtil.getPulseIdAttribute(availability),
 180                                         getPulseTableSettings(state.getChild(PULSES_TABLE)));
 181                         pulsesFilter = FilterComponent.createFilterComponent(pulsesTable, pulsesTableFilter,
 182                                         getItems().apply(JfxConstants.JFX_PULSE_FILTER), pageContainer.getSelectionStore()::getSelections,
 183                                         this::onPulsesFilterChange);
 184                         pulsesTable.getManager().getViewer().addSelectionChangedListener(e -> onPulsesSelected());
 185                         DataPageToolkit.addContextMenus(pageContainer, pulsesTable, Messages.JfxPage_PULSE_HISTOGRAM_SELECTION,
 186                                         pulsesFilter.getShowSearchAction(), pulsesFilter.getShowFilterAction());
 187                         pulsesFilter.loadState(state.getChild(PULSES_FILTER));
 188 
 189                         phaseList.addColumn(JfrAttributes.DURATION);
 190                         phaseList.addColumn(JfrAttributes.START_TIME);
 191                         phaseList.addColumn(JfxVersionUtil.getPhaseNameAttribute(availability));
 192                         phaseList.addColumn(JfrAttributes.EVENT_THREAD);
 193                         phaseList.addColumn(JfxVersionUtil.getPulseIdAttribute(availability));
 194                         
 195                         phasesTable = phaseList.buildWithoutBorder(phasesSash, getPhaseListSettings(state.getChild(PHASES_TABLE)));
 196                         phasesFilter = FilterComponent.createFilterComponent(phasesTable, phasesTableFilter,
 197                                         getItems().apply(JfxConstants.JFX_PULSE_FILTER), pageContainer.getSelectionStore()::getSelections,
 198                                         this::onPhasesFilterChange);
 199                         phasesTable.getManager().getViewer()
 200                                         .addSelectionChangedListener(e -> onPhasesSelected(!e.getSelection().isEmpty()));
 201                         MCContextMenuManager itemMM = MCContextMenuManager
 202                                         .create(phasesTable.getManager().getViewer().getControl());
 203                         ColumnMenusFactory.addDefaultMenus(phasesTable.getManager(), itemMM);
 204                         itemMM.add(phasesFilter.getShowSearchAction());
 205                         itemMM.add(phasesFilter.getShowFilterAction());
 206                         SelectionStoreActionToolkit.addSelectionStoreActions(pageContainer.getSelectionStore(), phasesTable,
 207                                         Messages.JfxPage_PHASE_TABLE_SELECTION, itemMM);
 208                         phasesFilter.loadState(state.getChild(PHASES_FILTER));
 209 
 210                         Section input = CompositeToolkit.createSection(tableSash, toolkit, Messages.JfxPage_INPUT);
 211                         inputTable = INPUT_HISTOGRAM.buildWithoutBorder(input, JfxConstants.INPUT_TYPE,
 212                                         getInputTableSettings(state.getChild(INPUT_TABLE)));
 213                         inputFilter = FilterComponent.createFilterComponent(inputTable, inputTableFilter, getItems(),
 214                                         pageContainer.getSelectionStore()::getSelections, this::onInputFilterChange);
 215                         inputTable.getManager().getViewer().addSelectionChangedListener(e -> buildChart());
 216                         inputTable.getManager().getViewer().addSelectionChangedListener(
 217                                         e -> pageContainer.showSelection(inputTable.getSelection().getItems()));
 218                         DataPageToolkit.addContextMenus(pageContainer, inputTable, Messages.JfxPage_INPUT_HISTOGRAM_SELECTION,
 219                                         inputFilter.getShowSearchAction(), inputFilter.getShowFilterAction());
 220                         input.setClient(inputFilter.getComponent());
 221                         inputFilter.loadState(state.getChild(INPUT_FILTER));
 222 
 223                         chartCanvas = new ChartCanvas(mainSash);
 224                         DataPageToolkit.createChartTimestampTooltip(chartCanvas);
 225                         chart = new XYChart(editor.getRecordingRange(), RendererToolkit.empty(), 180);
 226                         chart.setVisibleRange(timelineRange.getStart(), timelineRange.getEnd());
 227                         chart.addVisibleRangeListener(r -> timelineRange = r);
 228                         DataPageToolkit.setChart(chartCanvas, chart, pageContainer::showSelection);
 229 
 230                         PersistableSashForm.loadState(mainSash, state.getChild(MAIN_SASH));
 231                         PersistableSashForm.loadState(tableSash, state.getChild(TABLE_SASH));
 232                         PersistableSashForm.loadState(phasesSash, state.getChild(PHASES_SASH));
 233 
 234                         flavorSelector = FlavorSelector.itemsWithTimerange(form, JfxConstants.JFX_FILTER, items.getItems(),
 235                                         pageContainer, this::onInputSelected, this::onShow, flavorSelectorState);
 236 
 237                         onPulsesFilterChange(pulsesTableFilter);
 238                         onPhasesFilterChange(phasesTableFilter);
 239                         onInputFilterChange(inputTableFilter);
 240 
 241                         pulsesTable.getManager().setSelectionState(pulseSelection);
 242                         phasesTable.getManager().setSelectionState(phaseSelection);
 243                         inputTable.getManager().setSelectionState(inputSelection);
 244                 }
 245 
 246                 private void onPulsesFilterChange(IItemFilter newFilter) {
 247                         pulsesFilter.filterChangeHelper(newFilter, pulsesTable, getItems().apply(JfxConstants.JFX_PULSE_FILTER));
 248                         pulsesTableFilter = newFilter;
 249                 }
 250 
 251                 private void onPhasesFilterChange(IItemFilter newFilter) {
 252                         phasesFilter.filterChangeHelper(newFilter, phasesTable, getItems().apply(JfxConstants.JFX_PULSE_FILTER));
 253                         phasesTableFilter = newFilter;
 254                 }
 255 
 256                 private void onInputFilterChange(IItemFilter newFilter) {
 257                         inputFilter.filterChangeHelper(newFilter, inputTable, getItems().apply(JfxConstants.JFX_INPUT_FILTER));
 258                         inputTableFilter = newFilter;
 259                 }
 260 
 261                 @Override
 262                 public void saveTo(IWritableState state) {
 263                         PersistableSashForm.saveState(mainSash, state.createChild(MAIN_SASH));
 264                         PersistableSashForm.saveState(tableSash, state.createChild(TABLE_SASH));
 265                         PersistableSashForm.saveState(phasesSash, state.createChild(PHASES_SASH));
 266                         pulsesTable.getManager().getSettings().saveState(state.createChild(PULSES_TABLE));
 267                         phasesTable.getManager().getSettings().saveState(state.createChild(PHASES_TABLE));
 268                         inputTable.getManager().getSettings().saveState(state.createChild(INPUT_TABLE));
 269                         pulsesFilter.saveState(state.createChild(PULSES_FILTER));
 270                         phasesFilter.saveState(state.createChild(PHASES_FILTER));
 271                         inputFilter.saveState(state.createChild(INPUT_FILTER));
 272 
 273                         saveToLocal();
 274                 }
 275 
 276                 private void saveToLocal() {
 277                         pulseSelection = pulsesTable.getManager().getSelectionState();
 278                         phaseSelection = phasesTable.getManager().getSelectionState();
 279                         inputSelection = inputTable.getManager().getSelectionState();
 280                         flavorSelectorState = flavorSelector.getFlavorSelectorState();
 281                 }
 282 
 283                 private void onShow(Boolean show) {
 284                         IRange<IQuantity> range = show ? currentRange : pageContainer.getRecordingRange();
 285                         chart.setVisibleRange(range.getStart(), range.getEnd());
 286                         chartCanvas.redrawChart();
 287                 }
 288 
 289                 private void onInputSelected(IItemCollection items, IRange<IQuantity> currentRange) {
 290                         selectionItems = items;
 291                         this.currentRange = currentRange;
 292                         phaseItems = getItems().apply(JfxConstants.JFX_PULSE_FILTER);
 293                         pulsesTable.show(phaseItems);
 294                         inputTable.show(getItems().apply(JfxConstants.JFX_INPUT_FILTER));
 295 
 296                         buildChart();
 297                 }
 298 
 299                 private IItemCollection getItems() {
 300                         return selectionItems != null ? selectionItems : items.getItems();
 301                 }
 302 
 303                 private void buildChart() {
 304                         List<IXDataRenderer> rows = new ArrayList<>();
 305                         Stream<IXDataRenderer> phaseRows = AggregationGrid.mapItems(ItemCollectionToolkit.stream(phaseItems),
 306                                         JfrAttributes.EVENT_THREAD, JfxPage::buildThreadRenderer);
 307                         phaseRows.forEach(rows::add);
 308 
 309                         HistogramSelection inputSelection = inputTable.getSelection();
 310                         IItemCollection inputItems = inputSelection.getRowCount() > 0 ? inputSelection.getItems()
 311                                         : getItems().apply(JfxConstants.JFX_INPUT_FILTER);
 312                         IXDataRenderer inputRenderer = DataPageToolkit.buildSpanRenderer(inputItems,
 313                                         DataPageToolkit.getAttributeValueColor(JfxConstants.INPUT_TYPE));
 314                         rows.add(new ItemRow(Messages.JfxPage_INPUTS, JfxConstants.INPUT_TYPE.getDescription(), inputRenderer,
 315                                         inputItems));
 316 
 317                         chartCanvas.replaceRenderer(RendererToolkit.uniformRows(rows));
 318                 }
 319 
 320                 private void onPulsesSelected() {
 321                         phasesTable.show(pulsesTable.getSelection().getItems());
 322                         onPhasesSelected(false);
 323                 }
 324 
 325                 private void onPhasesSelected(boolean fromPhasesTable) {
 326                         HistogramSelection s = pulsesTable.getSelection();
 327                         if (fromPhasesTable) {
 328                                 IItemCollection phasesItems = ItemCollectionToolkit.build(phasesTable.getSelection().get());
 329                                 setChartVisibleRange(phasesItems);
 330                                 showSelectedPhases(phasesItems);
 331                         } else if (s.getRowCount() > 0) {
 332                                 IItemCollection selectedItems = s.getItems();
 333                                 setChartVisibleRange(selectedItems);
 334                                 showSelectedPhases(selectedItems);
 335                         } else {
 336                                 showSelectedPhases(getItems().apply(JfxConstants.JFX_PULSE_FILTER));
 337                         }
 338                 }
 339 
 340                 private void setChartVisibleRange(IItemCollection toShowItems) {
 341                         IAggregator<IQuantity, ?> firstStartAggregator = Aggregators.min(JfrAttributes.START_TIME);
 342                         IQuantity firstSelected = toShowItems.getAggregate(firstStartAggregator);
 343                         IAggregator<IQuantity, ?> lastEndAggregator = Aggregators.max(JfrAttributes.END_TIME);
 344                         IQuantity lastSelected = toShowItems.getAggregate(lastEndAggregator);
 345                         chart.setVisibleRange(firstSelected, lastSelected);
 346                 }
 347 
 348                 private void showSelectedPhases(IItemCollection phasesItems) {
 349                         this.phaseItems = phasesItems;
 350                         buildChart();
 351                         pageContainer.showSelection(phasesItems);
 352                 }
 353 
 354         }
 355 
 356         private IRange<IQuantity> timelineRange;
 357         private SelectionState pulseSelection;
 358         private SelectionState phaseSelection;
 359         private SelectionState inputSelection;
 360         private FlavorSelectorState flavorSelectorState;
 361         private IItemFilter pulsesTableFilter;
 362         private IItemFilter phasesTableFilter;
 363         private IItemFilter inputTableFilter;
 364 
 365         public JfxPage(IPageDefinition definition, StreamModel items, IPageContainer editor) {
 366                 super(definition, items, editor);
 367                 timelineRange = editor.getRecordingRange();
 368         }
 369 
 370         @Override
 371         public IItemFilter getDefaultSelectionFilter() {
 372                 return JfxConstants.JFX_FILTER;
 373         }
 374 
 375         private static IXDataRenderer buildThreadRenderer(Object threadName, IItemCollection items) {
 376                 // Attribute only used for looking up color and name information here
 377                 IXDataRenderer phaseRenderer = DataPageToolkit.buildSpanRenderer(items,
 378                                 DataPageToolkit.getAttributeValueColor(JfxConstants.ATTRIBUTE_PHASE_NAME_12));
 379                 return new ItemRow(String.valueOf(threadName), JfxConstants.ATTRIBUTE_PHASE_NAME_12.getDescription(), phaseRenderer, items);
 380         }
 381 
 382         private static TableSettings getPulseTableSettings(IState state) {
 383                 if (state == null) {
 384                         return new TableSettings(TOTAL_DURATION,
 385                                         Arrays.asList(new ColumnSettings(ItemHistogram.KEY_COL_ID, false, 75, false),
 386                                                         new ColumnSettings(TOTAL_DURATION, false, 75, false)));
 387                 } else {
 388                         return new TableSettings(state);
 389                 }
 390         }
 391 
 392         private static TableSettings getPhaseListSettings(IState state) {
 393                 if (state == null) {
 394                         return new TableSettings(JfrAttributes.DURATION.getIdentifier(),
 395                                         Arrays.asList(new ColumnSettings(JfrAttributes.DURATION.getIdentifier(), false, 100, false),
 396                                                         new ColumnSettings(JfrAttributes.DURATION.getIdentifier(), false, 200, false),
 397                                                         new ColumnSettings(JfxConstants.ATTRIBUTE_PHASE_NAME_12.getIdentifier(), false, 100, false),
 398                                                         new ColumnSettings(JfxConstants.ATTRIBUTE_PULSE_ID_12.getIdentifier(), false, 100, false),
 399                                                         new ColumnSettings(JfrAttributes.EVENT_THREAD.getIdentifier(), false, 200, false)));
 400                 } else {
 401                         return new TableSettings(state);
 402                 }
 403         }
 404 
 405         private static TableSettings getInputTableSettings(IState state) {
 406                 if (state == null) {
 407                         return new TableSettings(TOTAL_DURATION,
 408                                         Arrays.asList(new ColumnSettings(ItemHistogram.KEY_COL_ID, false, 100, false),
 409                                                         new ColumnSettings(TOTAL_DURATION, false, 75, false),
 410                                                         new ColumnSettings(ItemHistogram.COUNT_COL_ID, false, 100, false)));
 411                 } else {
 412                         return new TableSettings(state);
 413                 }
 414         }
 415 
 416         @Override
 417         public IPageUI display(Composite parent, FormToolkit toolkit, IPageContainer editor, IState state) {
 418                 return new JfxUI(parent, toolkit, editor, state, getDataSource(), getName(), getIcon());
 419         }
 420 
 421 }