I'm trying to use an adapted version of the Snippet7.java in a Editor-Pluging I'm developping.
And I'm encountering some problems when closing the PrintPreview window.
If we use the Snippet7 as it is, you will not have any problems, since there is a while loop looking at isDisposed parameter.
and closing all the display.
<code>
while ( !shell.isDisposed() )
if ( !display.readAndDispatch() )
display.sleep();
display.dispose();
</code>
Since I'm implementing a Plugin, I wasn't able to use it so. So I created a specific Dialog. Below my createShell function.
If my PrintPreview Object is initialised but the PrinterData is not set, I'm able to close the created Window.
Overwise, clicking on the Cross to close the window will not work, and I will have to Force Quit to be able to work with eclipse again.
In order to find the aim of the Problem, I added a dispose listener to my dialog, and included some println (see in the createShell function below).
And I can conclude that the function preview.dispose() do not finish.
Do you have some Idea ?
Did I something wrong ?
<code>
public final Shell createShell(PrintJob printJob) {
this.printJob = printJob;
final Shell dialog = new Shell(this.parentShell, SWT.DIALOG_TRIM
| SWT.APPLICATION_MODAL);
These are the forums. With bugs it is more effective to use the tracker. See the navigation links above: Project, Tracker, Mailing Lists, etc. Under Tracker, there is a category for Bugs. If you would be so kind as to submit a bug report there, it would help keep things orderly.
If you do not have a stack trace available, then please provide a standalone snippet (preferably one I can just paste into my workspace and run) which demonstrates the problem.
Also, am I correct in guessing that you are running Mac OSX?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Linux explains it actually. I've spent many hours troubleshooting it--SWT is having major problems printing with lib-cairo at the moment. One main problem is that cairo doesn't have API for cancelling a running print job. If you checkout the PaperClips sources from SVN HEAD, there is a workaround for the print preview problems. This workaround has the side effect of the printer feeding out a blank page every time a PrintPreview control is disposed. I have no way to avoid this currently.
If you look in the bug tracker, you will see two Linux bugs already filed, where discussions about this problem have already taken place.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By moving my code to a stand-alone snippet, I got the stack trace :
(SWT:8214): GLib-CRITICAL **: g_io_channel_write_chars: assertion `channel->is_writeable' failed
Hi everybody,
I'm trying to use an adapted version of the Snippet7.java in a Editor-Pluging I'm developping.
And I'm encountering some problems when closing the PrintPreview window.
If we use the Snippet7 as it is, you will not have any problems, since there is a while loop looking at isDisposed parameter.
and closing all the display.
<code>
while ( !shell.isDisposed() )
if ( !display.readAndDispatch() )
display.sleep();
display.dispose();
</code>
Since I'm implementing a Plugin, I wasn't able to use it so. So I created a specific Dialog. Below my createShell function.
If my PrintPreview Object is initialised but the PrinterData is not set, I'm able to close the created Window.
Overwise, clicking on the Cross to close the window will not work, and I will have to Force Quit to be able to work with eclipse again.
In order to find the aim of the Problem, I added a dispose listener to my dialog, and included some println (see in the createShell function below).
And I can conclude that the function preview.dispose() do not finish.
Do you have some Idea ?
Did I something wrong ?
<code>
public final Shell createShell(PrintJob printJob) {
this.printJob = printJob;
final Shell dialog = new Shell(this.parentShell, SWT.DIALOG_TRIM
| SWT.APPLICATION_MODAL);
dialog.setText( "Snippet7.java" );
dialog.setBounds( 100, 100, 800, 600 );
dialog.setLayout( new GridLayout( 1, false ) );
createButtonPanel( dialog ).setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
createScrollingPreview( dialog ).setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
preview.setPrintJob( printJob );
preview.setPrinterData( this.printerData );
updatePreviewSize();
updatePageNumber(dialog);
dialog.addDisposeListener(new DisposeListener(){
public void widgetDisposed(DisposeEvent e) {
System.out.println("DISPOSE1");
preview.setEnabled(false);
System.out.println("DISPOSE2");
scroll.setEnabled(false);
System.out.println("DISPOSE3");
preview.dispose();
System.out.println("DISPOSE4");
}
});
return dialog;
}
</code>
Thanks for you Help
Regards
Woolite
Would you please file a bug, and attach a stack trace?
Matthew
Hi,
What do you meen, saying "file a bug" ?
I don't have any stacktrace, it's like a loop without end.
Best Regards,
Woolite
These are the forums. With bugs it is more effective to use the tracker. See the navigation links above: Project, Tracker, Mailing Lists, etc. Under Tracker, there is a category for Bugs. If you would be so kind as to submit a bug report there, it would help keep things orderly.
If you do not have a stack trace available, then please provide a standalone snippet (preferably one I can just paste into my workspace and run) which demonstrates the problem.
Also, am I correct in guessing that you are running Mac OSX?
Thanks,
I will generate a "post" in the bug tracker.
I'm under Linux (Ubuntu).
Regards,
Woolite
Linux explains it actually. I've spent many hours troubleshooting it--SWT is having major problems printing with lib-cairo at the moment. One main problem is that cairo doesn't have API for cancelling a running print job. If you checkout the PaperClips sources from SVN HEAD, there is a workaround for the print preview problems. This workaround has the side effect of the printer feeding out a blank page every time a PrintPreview control is disposed. I have no way to avoid this currently.
If you look in the bug tracker, you will see two Linux bugs already filed, where discussions about this problem have already taken place.
Thanks,
By moving my code to a stand-alone snippet, I got the stack trace :
(SWT:8214): GLib-CRITICAL **: g_io_channel_write_chars: assertion `channel->is_writeable' failed
And looking at your actual bug reports I found this interesting link.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=212594
Thanks for your Help.
Best Regards,
Woolite