Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ua/org.eclipse.help.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %help_system_plugin_name
Bundle-SymbolicName: org.eclipse.help.ui; singleton:=true
Bundle-Version: 4.8.0.qualifier
Bundle-Version: 4.8.100.qualifier
Bundle-Activator: org.eclipse.help.ui.internal.HelpUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.BrowserFunction;
import org.eclipse.swt.browser.LocationAdapter;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.browser.LocationListener;
Expand Down Expand Up @@ -166,16 +167,13 @@ public void controlResized(ControlEvent e) {
shell.open();
//browser.setUrl("about:blank");

addNeedModalBrowserFunction(browser);
addResetNeedModalLocationListener(browser);

browser.addLocationListener(new LocationAdapter() {

@Override
public void changing(LocationEvent e) {
// hack to know when help webapp needs modal window
modalRequestTime = 0;
if (e.location != null
&& e.location.startsWith("javascript://needModal")) { //$NON-NLS-1$
modalRequestTime = System.currentTimeMillis();
}
if (!e.doit && e.location != null
&& e.location.startsWith("https://")) { //$NON-NLS-1$
try {
Expand Down Expand Up @@ -211,19 +209,33 @@ public EmbeddedBrowser(WindowEvent event, Shell parent) {
initialize(browser);
event.browser = browser;

browser.addLocationListener(new LocationAdapter() {
addNeedModalBrowserFunction(browser);
addResetNeedModalLocationListener(browser);
}

@Override
public void changing(LocationEvent e) {
// hack to know when help webapp needs modal window
modalRequestTime = 0;
if (e.location != null
&& e.location.startsWith("javascript://needModal")) { //$NON-NLS-1$
// hack to know when help webapp needs modal window
// use a browser function to be more robust
// see also https://github.com/eclipse-platform/eclipse.platform.swt/issues/2006
private void addNeedModalBrowserFunction(Browser browser) {
browser.getDisplay().asyncExec(() -> {
if (browser.isDisposed()) {
return;
}
new BrowserFunction(browser, "swtHintNeedModalPopup") { //$NON-NLS-1$
@Override
public Object function(Object[] arguments) {
super.function(arguments);
modalRequestTime = System.currentTimeMillis();
return null;
}
}
};
});
}

private void addResetNeedModalLocationListener(Browser browser) {
LocationListener.changingAdapter(e -> modalRequestTime = 0);
}

private static void initializeShell(Shell s) {
s.setText(initialTitle);
final Image[] shellImages = createImages();
Expand Down
2 changes: 1 addition & 1 deletion ua/org.eclipse.help.webapp/advanced/navActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function quickSearch(quickSearchType, errorMsg) { //search this topic and all s
}
// move the dialog just a bit higher than the middle
if (t-50 > 0) t = t-50;
window.location="javascript://needModal";
if (typeof top.swtHintNeedModalPopup === "function") top.swtHintNeedModalPopup();
// Defect 593 ends

var quickSearchWindow = window.open("quickSearch.jsp" + parameters, "QuickSearch", "location=no, status=no,resizable=yes,height="+h+",width="+w +",left="+l+",top="+t);
Expand Down
2 changes: 1 addition & 1 deletion ua/org.eclipse.help.webapp/advanced/searchScoped.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ if (data.isIE()){
// move the dialog just a bit higher than the middle
if (t-50 > 0) t = t-50;

window.location="javascript://needModal";
if (typeof top.swtHintNeedModalPopup === "function") top.swtHintNeedModalPopup();
advancedDialog = window.open("workingSetManager.jsp?workingSet="+encodeURIComponent(workingSet), "advancedDialog", "resizable=yes,height="+h+",width="+w+",left="+l+",top="+t );
advancedDialog.focus();
}
Expand Down
2 changes: 1 addition & 1 deletion ua/org.eclipse.help.webapp/advanced/searchSimple.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function saveSelectedBooks(books)

function openAdvanced()
{
window.location="javascript://needModal";
if (typeof top.swtHintNeedModalPopup === "function") top.swtHintNeedModalPopup();
advancedDialog = window.open("advanced.jsp?searchWord="+encodeURIComponent(document.getElementById("searchWord").value), "advancedDialog", "resizable=yes,height="+h+",width="+w );
advancedDialog.focus();
}
Expand Down
4 changes: 2 additions & 2 deletions ua/org.eclipse.help.webapp/advanced/views.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ if (data.isIE()){
// move the dialog just a bit higher than the middle
if (t-50 > 0) t = t-50;

window.location="javascript://needModal";
if (typeof top.swtHintNeedModalPopup === "function") top.swtHintNeedModalPopup();
confirmShowAllDialog = window.open("confirmShowAll.jsp", "confirmShowAllDialog", "resizable=no,height="+h+",width="+w+",left="+l+",top="+t );
confirmShowAllDialog.focus();
}
Expand All @@ -112,7 +112,7 @@ if (data.isIE()){
// move the dialog just a bit higher than the middle
if (t-50 > 0) t = t-50;

window.location="javascript://needModal";
if (typeof top.swtHintNeedModalPopup === "function") top.swtHintNeedModalPopup();
selectScopeDialog = window.open("selectScope.jsp", "selectScopeDialog", "resizable=no,height="+h+",width="+w+",left="+l+",top="+t );
selectScopeDialog.focus();
}
Expand Down
4 changes: 2 additions & 2 deletions ua/org.eclipse.help.webapp/advanced/workingSetManager.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function newWorkingSet() {
%>
// move the dialog just a bit higher than the middle
if (t-50 > 0) t = t-50;
window.location="javascript://needModal";
if (typeof top.swtHintNeedModalPopup === "function") top.swtHintNeedModalPopup();
workingSetDialog = window.open("workingSet.jsp?operation=add&workingSet="+encodeURIComponent(getWorkingSet()), "workingSetDialog", "resizable=yes,height="+h+",width="+w +",left="+l+",top="+t);
workingSetDialog.focus();
}
Expand All @@ -247,7 +247,7 @@ function editWorkingSet() {
// move the dialog just a bit higher than the middle
if (t-50 > 0) t = t-50;

window.location="javascript://needModal";
if (typeof top.swtHintNeedModalPopup === "function") top.swtHintNeedModalPopup();
workingSetDialog = window.open("workingSet.jsp?operation=edit&workingSet="+encodeURIComponent(getWorkingSet()), "workingSetDialog", "resizable=no,height="+h+",width="+w+",left="+l+",top="+t );
workingSetDialog.focus();
}
Expand Down
Loading