JFace对话框总是在顶部和模式上。

时间:2022-03-14 22:45:39

I have created a JFace Modeless Dialog and trying to set shell style with following options

我创建了一个JFace非模态对话框,并尝试使用以下选项设置shell样式。

setShellStyle(SWT.CLOSE | SWT.TITLE |SWT.MODELESS |SWT.ON_TOP);

I want this dialog to be always on top , but the dialog gets minimized when I minimize the eclipse workbench.

我希望这个对话框总是在顶部,但是当我最小化eclipse工作台时,对话框会被最小化。

Am I missing something with the shell style bits or is this the expected behavior?

我是否遗漏了shell风格的部分,或者这是预期的行为?

How can I make an always on top dialog even if we minimize the eclipse application?

即使我们最小化了eclipse应用程序,我怎么能始终在top对话框中?

public class Capture extends Dialog {

    public Capture(Shell parentShell) {
        super(parentShell);
        setShellStyle(SWT.CLOSE | SWT.TITLE |SWT.MODELESS |SWT.ON_TOP);
    }

}

2 个解决方案

#1


1  

Use null for the parent Shell so that the dialog is not a child of the window you are minimizing.

为父Shell使用null,这样对话框就不是窗口的子元素,而是最小化。

#2


1  

I don't have enough reputation to comment. So posting this as an answer. What is the parentShell in this? That determines the life and behavior of the dialog. Either create a new shell or put null as the shell. That should remove the tie up with the workbench. Another question : Why are trying this?

我没有足够的声誉来评论。所以把这个作为答案。这里面的父母是什么?这决定了对话框的生命和行为。要么创建一个新shell,要么将null作为shell。这样就可以把工作台上的连接去掉。另一个问题是:为什么要这么做?

#1


1  

Use null for the parent Shell so that the dialog is not a child of the window you are minimizing.

为父Shell使用null,这样对话框就不是窗口的子元素,而是最小化。

#2


1  

I don't have enough reputation to comment. So posting this as an answer. What is the parentShell in this? That determines the life and behavior of the dialog. Either create a new shell or put null as the shell. That should remove the tie up with the workbench. Another question : Why are trying this?

我没有足够的声誉来评论。所以把这个作为答案。这里面的父母是什么?这决定了对话框的生命和行为。要么创建一个新shell,要么将null作为shell。这样就可以把工作台上的连接去掉。另一个问题是:为什么要这么做?