final Shell shell = new Shell(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
shell.setLayout(new GridLayout(1,false));
Composite tabItem = new Composite(shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
tabItem.setLayout(new GridLayout(1,false));
final ViewerComposite viewer = new ViewerComposite(tabItem, SWT.NONE);
viewer.getReportViewer().setDocument(jasperPrint);
shell.pack();
shell.open();
Rectangle shellBounds = shell.getBounds();
Point dialogSize = shell.getSize();
shell.setLocation(
shellBounds.x + (shellBounds.width - dialogSize.x) / 2,
shellBounds.y + (shellBounds.height - dialogSize.y) / 2);
}else {
final ViewerComposite viewer = new ViewerComposite(tabFolder, SWT.NONE);
if(jasperPrint.getPages().isEmpty()){
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_INFORMATION);
messageBox.setText("Gerente Digital!");
messageBox.setMessage("O relat�rio solicitado est� vazio.");
messageBox.open();
}else{
viewer.getReportViewer().setDocument(jasperPrint);
CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
tabItem.setControl(viewer);
tabItem.setText(reportName);
tabFolder.setSelection(tabItem);
tabItem.addDisposeListener(new DisposeListener(){
public void widgetDisposed(DisposeEvent arg0) {
viewer.dispose();
}
});
}
}
}