Skip to content

Commit

Permalink
The preview does not work anymore: #1901 (#1904)
Browse files Browse the repository at this point in the history
After switching the default browser to Edge in issues #1736 and #1737
the preview pane was broken because Edge does not like plain filenames.

Fixed:

1. Convert the plain file name to a file URL

This also fixed:

* Ask to save the editor when it is dirty and Preview is
requested. #1902
* 'New Preview Prototype' tab must be called Preview #1903
  • Loading branch information
wimjongman authored Sep 12, 2024
1 parent 67b980a commit aa849c4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -772,12 +772,12 @@ private void showReportOutputJob(RenderJobRule jobRule) {
public void work(IProgressMonitor monitor) {
monitor.subTask("Show report in Browser"); //$NON-NLS-1$
if (!form.isDisposed()) {
// browser.setUrl( outputLocation
// + ( currentBookmark == null ? ""
// : ( "#" + currentBookmark ) ) );
browser.setUrl(outputLocation);
// if special the anchor, SWT browser will not refresh
// browser.refresh( );
try {
String url = new File(outputLocation).toURI().toURL().toString();
browser.setUrl(url);
} catch (Exception e) {
browser.setUrl(outputLocation);
}
if (currentPageNum < totalPageNum) {
navNextAction.setEnabled(true);
navLastAction.setEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ designer.preview.previewtoolbarmenuaction.label=View Report
designer.preview.previewcascadingmenugroup.label=View &Report
ActionSet.Preview=Preview

template.preview=New Preview Pro&totype
design.preview=New Preview Pro&totype
template.preview=Pre&view
design.preview=Pre&view

preference.preview=Preview
preference.preview.server=Preview Server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
import org.eclipse.birt.report.designer.ui.preview.extension.ViewerExtensionManager;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.part.EditorPart;
Expand Down Expand Up @@ -64,15 +67,17 @@ public ReportPreviewFormPage() throws FrameworkException {
reportViewer = manager.createViewer(VIEWER_ID);
}

/*
* (non-Javadoc)
*
* @see
* org.eclipse.birt.report.designer.ui.editors.IReportEditorPage#onBroughtToTop(
* org.eclipse.birt.report.designer.ui.editors.IReportEditorPage)
*/
@Override
public boolean onBroughtToTop(IReportEditorPage prePage) {
if (editor.isDirty()) {
int SAVEBUTTON = 0;
int buttonPressed = MessageDialog.open(MessageDialog.QUESTION, getSite().getShell(),
"Save Report", "Save the report so that the preview can show the latest changes?",
SWT.SHEET, "Save", "Don't Save");
if (buttonPressed == SAVEBUTTON) {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().saveEditor(editor, false);
}
}
startRender();
return true;
}
Expand Down Expand Up @@ -319,6 +324,11 @@ protected void finalize() throws Throwable {
*/
@Override
public void doSave(IProgressMonitor monitor) {
IReportProvider provider = getProvider();
if (provider != null) {
provider.saveReport(provider.queryReportModuleHandle(), getEditorInput(), monitor);
firePropertyChange(PROP_DIRTY);
}
}

/*
Expand Down Expand Up @@ -352,11 +362,6 @@ public boolean isSaveAsAllowed() {
return false;
}

/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
*/
@Override
public void setFocus() {
}
Expand Down

0 comments on commit aa849c4

Please sign in to comment.