Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
7812: Unable to open links from Automated Result analysis page
Reviewed-by: hirt
  • Loading branch information
vpurnam authored and Suchita Chaturvedi committed Sep 16, 2022
1 parent 0b91cf1 commit 9b8e044
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 10 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -88,6 +88,7 @@ public class ImageConstants {
public static final String ICON_HEATMAP = "heatmap.png"; //$NON-NLS-1$
public static final String ICON_OVERVIEW = "overview.png"; //$NON-NLS-1$
public static final String ICON_TABLE = "table.gif"; //$NON-NLS-1$
public static final String ICON_BROWSER = "browser-16.png";

public static final String ICON_WARNING_OVERLAY = "warning_overlay.png"; //$NON-NLS-1$
public static final String ICON_INFO_OVERLAY = "info_overlay.png"; //$NON-NLS-1$
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -499,6 +499,7 @@ public class Messages extends NLS {
public static String ResultOverview_EXPORT_DIALOG_TITLE;
public static String ResultOverview_PAGE_DESC;
public static String ResultOverview_PAGE_NAME;
public static String ResultOverview_BROWSER_ACTION;
public static String ResultTableUi_SCORE_TOOLTIP;
public static String RuleManager_NULL_RESULT_DESCRIPTION;
public static String SAVE_AS_ERROR_MSG;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -151,6 +151,18 @@ public void run() {
}
}

class BrowserAction extends Action {
public BrowserAction(String text) {
super(text, IAction.AS_CHECK_BOX);
super.setImageDescriptor(ResultOverview.ICON_BROWSER);
}

@Override
public void run() {
browserAction.setChecked(true);
}
}

public static class ResultOverviewPageFactory implements IDataPageFactory {
@Override
public String getName(IState state) {
Expand Down Expand Up @@ -193,6 +205,8 @@ public ResultOverview(IPageDefinition dpd, StreamModel items, IPageContainer edi
.getMCImageDescriptor(ImageConstants.ICON_TABLE);
private static final ImageDescriptor ICON_EXPORT = FlightRecorderUI.getDefault()
.getMCImageDescriptor(ImageConstants.ICON_DOWNLOAD_TIME_INTERVAL);
private static final ImageDescriptor ICON_BROWSER = FlightRecorderUI.getDefault()
.getMCImageDescriptor(ImageConstants.ICON_BROWSER);

private Form form;
private FormToolkit toolkit;
Expand All @@ -201,6 +215,7 @@ public ResultOverview(IPageDefinition dpd, StreamModel items, IPageContainer edi
private ExportAction exportAction;
private ShowOkAction showOkAction;
private Separator separator;
private BrowserAction browserAction;

private boolean displayReport = !UIPlugin.getDefault().getAccessibilityMode();
private ResultReportUi report;
Expand All @@ -225,6 +240,9 @@ public IPageUI display(Composite parent, FormToolkit toolkit, IPageContainer edi
separator = new Separator();
separator.setId("separator"); //$NON-NLS-1$
form.getToolBarManager().add(separator);
browserAction = new BrowserAction(Messages.ResultOverview_BROWSER_ACTION);
browserAction.setId("browserAction");
form.getToolBarManager().add(browserAction);
reportAction = new DisplayModeAction(Messages.ResultOverview_DISPLAYMODE_REPORT, form, ICON_OVERVIEW, true);
tableAction = new DisplayModeAction(Messages.ResultOverview_DISPLAYMODE_TABLE, form, ICON_TABLE, false);
if (displayReport) {
Expand All @@ -245,6 +263,7 @@ private void setVisibleActions(boolean visible) {
form.getToolBarManager().find(showOkAction.getId()).setVisible(visible);
form.getToolBarManager().find(exportAction.getId()).setVisible(visible);
form.getToolBarManager().find(separator.getId()).setVisible(visible);
form.getToolBarManager().find(browserAction.getId()).setVisible(false);
form.getToolBarManager().update(true);
}

Expand Down Expand Up @@ -336,4 +355,18 @@ public void saveTo(IWritableState writableState) {
}
}

/**
* This method makes browser icon visible.
*/
public void enableBrowserAction() {
form.getToolBarManager().find(showOkAction.getId()).setVisible(false);
form.getToolBarManager().find(exportAction.getId()).setVisible(false);
form.getToolBarManager().find(separator.getId()).setVisible(false);
form.getToolBarManager().find(browserAction.getId()).setVisible(true);
browserAction.setChecked(true);
reportAction.setChecked(false);
tableAction.setChecked(false);
form.getToolBarManager().update(true);
}

}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -78,6 +78,7 @@
import org.openjdk.jmc.flightrecorder.ui.DataPageDescriptor;
import org.openjdk.jmc.flightrecorder.ui.FlightRecorderUI;
import org.openjdk.jmc.flightrecorder.ui.IPageContainer;
import org.openjdk.jmc.flightrecorder.ui.JfrEditor;
import org.openjdk.jmc.ui.misc.DisplayToolkit;

/**
Expand Down Expand Up @@ -437,8 +438,13 @@ public void completed(ProgressEvent event) {
if (isSinglePage) {
browser.execute(OVERVIEW_MAKE_SCALABLE);
}
browser.evaluate(OVERVIEW_UPDATE_PAGE_HEADERS_VISIBILITY);
isLoaded = true;
if (browser.getUrl().equals("about:blank")) {
browser.evaluate(OVERVIEW_UPDATE_PAGE_HEADERS_VISIBILITY);
isLoaded = true;
} else {
((ResultOverview) (((JfrEditor) editor).getCurrentPageUI())).enableBrowserAction();
return;
}

DisplayToolkit.safeAsyncExec(cmdExecRunnable);
}
Expand Down
@@ -1,5 +1,5 @@
#
# Copyright (c) 2018, 2021 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
Expand Down Expand Up @@ -436,6 +436,7 @@ ResultOverview_EXPORT_DIALOG_MESSAGE=HTML overview of the results of the automat
ResultOverview_EXPORT_DIALOG_TITLE=Export Overview HTML
ResultOverview_PAGE_DESC=Results from automated analysis grouped by page
ResultOverview_PAGE_NAME=Automated Analysis Results
ResultOverview_BROWSER_ACTION=Browser
# {0} is a localized severity string (e.g. Warning)
ResultTableUi_SCORE_TOOLTIP=Severity: {0}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -230,7 +230,7 @@ public static String getDescription(IResult result) {
String title = matcher.group(1);
String url = matcher.group(2);
String encodedUrl = Encode.forUriComponent(url);
String link = "<a class=\"anchorTag\" onclick=\"javascript:window.open(decodeURIComponent('" + encodedUrl //$NON-NLS-1$
String link = "<a class=\"anchorTag\" onclick=\"window.location.assign(decodeURIComponent('" + encodedUrl //$NON-NLS-1$
+ "'))\">" + title + "</a>"; //$NON-NLS-1$//$NON-NLS-2$
description = description.replace(matcher.group(), link);
}
Expand Down
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
-->
<html lang="en">
Expand Down

0 comments on commit 9b8e044

Please sign in to comment.