I need your help, In my swt app I need to show a simple message while some jfreechart chart is loading. Simply I put a shell at the beginning of the chart generating method and I close that shell at the end of the method. I know is not the best solution but I need a simply way to do that. The problem is that the shell is modal and it closes some other jobs running before, so I need a NO MODAL pop up. I tried with message box and dialogs but all of them have buttons, I only need a pop up without any buttons, with a only a label and an image. Thanks!
I put the relevant code:
in the generating chart method I call the shell create method:
Display display = PlatformUI.createDisplay();
Shell shell = new Shell(display,SWT.BACKGROUND);
generateMessageDialog(display,shell);
and this is the method to create the shell:
Monitor primary = display.getPrimaryMonitor ();
Rectangle bounds = primary.getBounds ();
shell.setSize(455, 295);
Rectangle rect = shell.getBounds ();
int x = bounds.x + (bounds.width - rect.width) / 2;
int y = bounds.y + (bounds.height - rect.height) / 2;
shell.setLocation (x, y);
shell.setLayout(new FormLayout());
shell.setText("Information");
Label label = new Label(shell, SWT.NONE);
ImageDescriptor id = Activator.getImageDescriptor("icons/loading4_modificado.gif");
Image image = id.createImage();
label.setImage(image);
Label label2=new Label(shell, SWT.NONE);
label2.setText("Generating chart. Please, wait...");
FormData label1FD = new FormData();
label1FD.top = new FormAttachment(0, 120);
label1FD.left = new FormAttachment(0, 90);
label.setLayoutData(label1FD);
FormData label2FD = new FormData();
label2FD.top = new FormAttachment(0, 130);
label2FD.left = new FormAttachment(0, 160);
label2.setLayoutData(label2FD);
label2.setFont(new org.eclipse.swt.graphics.Font(null,"Arial", Font.PLAIN, 10));
shell.open();
shell.layout();
Creating the Shell with a style something like this:
new Shell(parentShell, SWT.ON_TOP | SWT.TOOL | SWT.NO_FOCUS);
gives you a 'tool tip' style shell.