Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Create a modal window(How can I create a modal window?)
Create a modal window [message #797549] Mon, 13 February 2012 11:22 Go to next message
Marco Carnazzo is currently offline Marco Carnazzo
Messages: 8
Registered: July 2009
Junior Member
Maybe it's a FAQ but I'm an e4 newbie and I didn't find anything about.

I want a modal, not resizable and not closeable window.
How can I create it? My window is a POJO, so I can't set SWT style.

Thank you.
Re: Create a modal window [message #798322 is a reply to message #797549] Tue, 14 February 2012 09:38 Go to previous messageGo to next message
Markus Stier is currently offline Markus Stier
Messages: 11
Registered: July 2009
Junior Member
In your Handler

@Execute
public void execute(IEclipseContext context) 
{
        LoginDialog loginDlg = ContextInjectionFactory.make(LoginDialog.class, context);

        loginDlg.create();

        // Make it modal
        loginDlg.setBlockOnOpen(true);
        loginDlg.open();
}


in your dialog
    
@Inject
public LoginDialog(@Named(IServiceConstants.ACTIVE_SHELL) Shell parentShell)
{
        super(parentShell);
        setShellStyle(SWT.BORDER | SWT.CLOSE | SWT.RESIZE | SWT.APPLICATION_MODAL);

}

@Override
protected Control createContents(Composite parent)
{
        Control cntrl = super.createContents(parent);
        setTitle("My title");

        // init controls
        
        return cntrl;
}




Markus
Re: Create a modal window [message #799132 is a reply to message #798322] Wed, 15 February 2012 08:37 Go to previous message
Marco Carnazzo is currently offline Marco Carnazzo
Messages: 8
Registered: July 2009
Junior Member
Thank you Markus.
But my question is: what if my dialog is a TrimmedWindow? (or anything in Application model)
Previous Topic:Problems creating a Part Toolbar
Next Topic:e4 DI, Gemini & Persistence
Goto Forum:
  


Current Time: Wed Jul 30 01:06:17 EDT 2014

Powered by FUDForum. Page generated in 0.03035 seconds