Skip to content

Commit

Permalink
7482: Confusing display of stack traces when selecting event types wi…
Browse files Browse the repository at this point in the history
…th no events

Reviewed-by: aptmac
  • Loading branch information
Jean-Philippe Bempel committed Jan 10, 2022
1 parent b65e351 commit ce10e3f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ ResultPage createResultPage() {
return p;
}

public IPageUI getCurrentPageUI() {
return this.currentPageUI;
}

@Override
public IDisplayablePage getDisplayablePage(DataPageDescriptor page) {
return pageMap.computeIfAbsent(page, this::buildPage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import org.openjdk.jmc.common.item.IType;
import org.openjdk.jmc.common.item.ItemFilters;
import org.openjdk.jmc.common.item.ItemToolkit;
import org.openjdk.jmc.common.item.PersistableItemFilter;
import org.openjdk.jmc.common.unit.ContentType;
import org.openjdk.jmc.common.unit.IQuantity;
import org.openjdk.jmc.common.unit.IRange;
Expand All @@ -77,6 +78,7 @@
import org.openjdk.jmc.flightrecorder.ui.IPageContainer;
import org.openjdk.jmc.flightrecorder.ui.IPageDefinition;
import org.openjdk.jmc.flightrecorder.ui.IPageUI;
import org.openjdk.jmc.flightrecorder.ui.JfrEditor;
import org.openjdk.jmc.flightrecorder.ui.RuleManager;
import org.openjdk.jmc.flightrecorder.ui.StreamModel;
import org.openjdk.jmc.flightrecorder.ui.common.AbstractDataPage;
Expand Down Expand Up @@ -147,14 +149,34 @@ public IPageUI display(Composite parent, FormToolkit toolkit, IPageContainer edi
public TreePath[] treeExpansion;
public FlavorSelectorState flavorSelectorState;
private IItemFilter flagsFilter;
private IPageContainer editor;
// public int topIndex;

public EventBrowserPage(IPageDefinition definition, StreamModel items, IPageContainer editor) {
super(definition, items, editor);
this.editor = editor;
}

static IItemFilter getPageFilter(IState state) {
if (state == null) {
return null;
}
IState filterElement = state.getChild("ItemFilter");
return filterElement == null ? null : PersistableItemFilter.readFrom(filterElement);
}

@Override
public IItemFilter getDefaultSelectionFilter() {
if (editor instanceof JfrEditor) {
JfrEditor jfrEditor = (JfrEditor) editor;
IPageUI currentPageUI = jfrEditor.getCurrentPageUI();
if (currentPageUI instanceof EventBrowserUI) {
EventBrowserUI ebUI = (EventBrowserUI) currentPageUI;
if (ebUI != null && ebUI.currentItemFilter != null) {
return ebUI.currentItemFilter;
}
}
}
return ItemFilters.all();
}

Expand All @@ -177,6 +199,7 @@ class EventBrowserUI implements IPageUI {
private Boolean showTypesWithoutEvents;
private Boolean showFilterAction;
private Boolean showSearchAction;
private IItemFilter currentItemFilter;

EventBrowserUI(Composite parent, FormToolkit toolkit, IState state, IPageContainer container) {
this.container = container;
Expand Down Expand Up @@ -263,7 +286,8 @@ private void refreshTree() {
private IItemCollection getFilteredItems() {
if (!selectedTypes.isEmpty()) {
Set<String> types = selectedTypes.stream().map(t -> t.getIdentifier()).collect(Collectors.toSet());
return selectionItems.apply(ItemFilters.type(types));
currentItemFilter = ItemFilters.type(types);
return selectionItems.apply(currentItemFilter);
}
return selectionItems;
}
Expand Down

0 comments on commit ce10e3f

Please sign in to comment.