开发者

Eclipse RCP detached views: How to control the z-index?

Let's say I have 2 views(A,B) detached. View A on top of开发者_JS百科 view B on top of workbench shell.

Question 1: How to let user click at a view to make it on top?

Question 2: Now I use a window of other app, say, notepad, to cover view A. Is it possible to let user just click at view A to flip it on top of the notepad while keeping view B and the main behind notepad?

Thanks for all your answer


I did some dirty work finally:

   <extension
         point="org.eclipse.ui.internalTweaklets">
      <tweaklet

definition="org.eclipse.ui.internal.tweaklets.WorkbenchImplementation"
            description="Customized Detached View"
            id="id1"
            implementation="tweaklets.WorkbenchImplementation"
            name="Customized Detached View">
      </tweaklet>
   </extension> 

My WorkbenchImplementation.java

public class WorkbenchImplementation extends Workbench3xImplementation {

    private static final Logger logger = LoggerFactory.getLogger(WorkbenchImplementation.class);

    @Override
    public WorkbenchWindow createWorkbenchWindow(int newWindowNumber) {
        // return super.createWorkbenchWindow(newWindowNumber);
        return new WorkbenchWindow(newWindowNumber) {

            @Override
            protected void configureShell(Shell shell) {
                super.configureShell(shell);

                try {
                    Field field = WorkbenchWindow.class.getDeclaredField("detachedWindowShells");
                    field.setAccessible(true);
                    field.set(this, createShellPool(shell));
                } catch (Exception e) {
                    logger.error("Error tweaking WorkbenchWindow", e);
                }
            }

        };
    }

    protected ShellPool createShellPool(Shell shell) {
        // return new ShellPool(null, SWT.TOOL | SWT.TITLE | SWT.MAX | SWT.RESIZE | Window.getDefaultOrientation());
        return new ShellPool(null, SWT.NO_TRIM | Window.getDefaultOrientation());
    }

}


There are not general answer to this question. The behavior of the window manager depends a lot on the native window manager. E.g. Windows 7 and OSX behaves differently.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜