@Override public void setActiveTab(ILaunchConfigurationTab tab) { if (activeTab != null) { activeTab.deactivated(workingCopy); activeTab.getControl().dispose(); } activeTab = tab; if (activeTab != null) { launchConfigArea.setRedraw(false); configNameText.setVisible(true); activeTab.createControl(launchConfigArea); // GridDataFactory.swtDefaults().grab(true, false).align(SWT.FILL, // SWT.BEGINNING).applyTo( // activeTab.getControl()); launchConfigArea.setContent(activeTab.getControl()); activeTab.getControl().setSize(activeTab.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT)); configUI.layout(true); activeTab.activated(workingCopy); launchConfigArea.setRedraw(true); } else { configNameText.setVisible(false); } updateButtons(); updateMessage(); }
/** * Resizes the Section's client and updates the Property Viewer's {@link ScrolledComposite} to * account for GridLayouts in the client. */ private void resizePropertyView() { // Disable re-drawing for the ScrolledComposite. scrollComposite.setRedraw(false); int verticalPadding = scrollComposite.getHorizontalBar().getSize().y; int horizontalPadding = scrollComposite.getVerticalBar().getSize().x; Rectangle clientArea = scrollComposite.getClientArea(); Point clientAreaSize = new Point(clientArea.width - horizontalPadding, clientArea.height - verticalPadding); // Recompute the size of the first Composite in the ScrolledComposite // based on the width of the ScrolledComposite's client area. Point size = scrollCompositeClient.computeSize(clientAreaSize.x, clientAreaSize.y); // Update the size of the ScrolledComposite's client. scrollCompositeClient.setSize(size); // Set the minimum size at which the ScrolledComposite will start // drawing scroll bars. This should be the size of its client area minus // the spaces the scroll bars would consume. scrollComposite.setMinSize(clientAreaSize.x + 1, clientAreaSize.y + 1); // We need to call layout() so the ScrolledComposite will update. scrollComposite.layout(); // Set the height hint for the Section's parent Composite. This keeps // the TableViewer from going beyond the bottom edge of the Properties // Viewer. We want to keep the add and delete buttons visible, and the // TableViewer already has its own scroll bars! Composite sectionParent = section.getParent(); GridData gridData = (GridData) sectionParent.getLayoutData(); GridLayout gridLayout = (GridLayout) sectionParent.getParent().getLayout(); gridData.heightHint = sectionParent.getParent().getSize().y - gridLayout.marginTop; // The parent of the Section has a FillLayout. Its parent has a // GridLayout, but sometimes it does not update. Tell it to layout so // the Section's parent will update its size. section.getParent().getParent().layout(); // Enable re-drawing for the ScrolledComposite. scrollComposite.setRedraw(true); return; }
/** * When any <code>ProgressReporterPanel</code> in this window is expanded or collapsed re-layout * the controls and window appropriately */ public void isCollapsed(boolean value) { if (null != shell && false == shell.isDisposed()) { scrollable.setRedraw(false); Rectangle r = scrollable.getClientArea(); scrollable.setMinSize(scrollChild.computeSize(r.width, SWT.DEFAULT)); /* * Resizing to fit the panel if there is only one */ if (pReporters.length == 1) { Point p = shell.computeSize(defaultShellWidth, SWT.DEFAULT); if (shell.getSize().y != p.y) { p.x = shell.getSize().x; shell.setSize(p); } } scrollable.layout(); scrollable.setRedraw(true); } }