Dependencies:
        JFace 3.22.100
        SWT 3.116.0 (win32.x64_86)

------

Hi,

I have a strange effect when I add a toolbar to a JFace application
window. It is a standalone JFace application, not an Eclipse plugin.

The problem occurs when I add at least one action to the ToolBarManager.
It works fine when the ToolBarManager is empty.

        @Override
        protected ToolBarManager createToolBarManager(int style) {

                ToolBarManager tbm = new ToolBarManager(style);
                tbm.add(new NewProjectAction()); // will cause problem
                return tbm;

If the action has been created, my overridden application window
functions getInitialSize() and getInitialLocation() will not be called
by the framework.

This is because the variable Window.resizeHasOccurred is true so the
function Window.initializeBounds() exits.

        protected void initializeBounds() {
                if (resizeListener != null) {
                        shell.removeListener(SWT.Resize, resizeListener);
                }
                if (resizeHasOccurred) { // Check if shell size has been set 
already.
                        return; // ** exiting here
                }

                Point size = getInitialSize();
                Point location = getInitialLocation(size);
                shell.setBounds(getConstrainedShellBounds(new 
Rectangle(location.x,
                                location.y, size.x, size.y)));
        }

As a workaround, I may override initializeBounds(). If not, the window
will be opened in minimal size at a random location.

But even if I implement initializeBounds(), I also notice the window
being opened in minimal size and random location, then disappearing and
being shown again in the required size and location.

Regards
Stefan

_______________________________________________
platform-dev mailing list
platform-dev@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/platform-dev

Reply via email to