Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 279228

Summary: [CTabFolder] Maximizing a minimized folder fires a "restore" event
Product: [RT] RAP Reporter: Nobody - feel free to take it <nobody>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: elias, ivan
Version: 1.2   
Target Milestone: 1.2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch. none

Description Nobody - feel free to take it CLA 2009-06-05 05:59:26 EDT
Build ID: latest RAP, FF 3.0.10 on ubuntu 9.04

Steps To Reproduce:
1. Run the provided code
2. Minimize the folder
3. Try to maximize: the folder gets restored, the tool bar icon does not update correctly (showing "minimize" and "maximize" actions) and a "restore" event is fired.
4. Watch the sysouts

Expected: the folder gets maximized, the tool bar shows the "minimize" and "restore" icons and a "maximize" event is fired.


More information:

public class CTabFolderMaximizeMinimized implements IEntryPoint {
    public int createUI() {
        Display display = new Display();

        final Shell shell = new Shell(display);
        shell.setLayout(new GridLayout());

        final CTabFolder folder = new CTabFolder(shell, SWT.BORDER);

        folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        for (int i = 0; i < 1; i++) {
            CTabItem item = new CTabItem(folder, SWT.NONE);
            item.setText("Item " + i);
            Text text = new Text(folder, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
            text.setText("Text for item " + i + "\n\none, two, three\n\nabcdefghijklmnop");
            item.setControl(text);
        }

        folder.setMinimizeVisible(true);
        folder.setMaximizeVisible(true);

        folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
            public void minimize(CTabFolderEvent event) {
                System.out.println("minimize");
                folder.setMinimized(true);
                shell.layout(true);
            }

            public void maximize(CTabFolderEvent event) {
                System.out.println("maximize");
                folder.setMaximized(true);
                folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                shell.layout(true);
            }

            public void restore(CTabFolderEvent event) {
                System.out.println("restore");
                folder.setMinimized(false);
                folder.setMaximized(false);
                folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
                shell.layout(true);
            }
        });
        shell.setSize(300, 300);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        display.dispose();
        return 0;
    }
}
Comment 1 Elias Volanakis CLA 2009-06-08 17:11:16 EDT
Jordan,

I assume this was the bug you mentioned this morning.

Elias.
Comment 2 Ivan Furnadjiev CLA 2009-06-10 09:56:46 EDT
Created attachment 138792 [details]
Proposed patch.

There was a typo in CTabFolder.js.
Comment 3 Ralf Sternberg CLA 2009-06-10 10:20:24 EDT
+1 for the patch, this is an obvious mistake and the fix should be included in the release
Comment 4 Ivan Furnadjiev CLA 2009-06-10 10:34:57 EDT
Changes are in CVS HEAD.