1 11 package org.eclipse.ui.internal.forms; 12 13 import org.eclipse.jface.wizard.*; 14 import org.eclipse.swt.SWT; 15 import org.eclipse.swt.widgets.*; 16 import org.eclipse.ui.forms.FormColors; 17 18 25 public class FormWizardDialog extends WizardDialog { 26 protected FormColors colors; 27 28 39 public FormWizardDialog( 40 Shell shell, 41 FormWizard wizard, 42 FormColors colors) { 43 super(shell, wizard); 44 setShellStyle(getShellStyle() | SWT.RESIZE); 45 this.colors = colors; 46 } 47 55 protected Control createDialogArea(Composite parent) { 56 Composite c = (Composite) super.createDialogArea(parent); 57 setChildColors(c); 58 c.setBackground(colors.getBackground()); 59 c.setForeground(colors.getForeground()); 60 return c; 61 } 62 69 protected Control createButtonBar(Composite parent) { 70 Control bar = super.createButtonBar(parent); 71 bar.setBackground(colors.getBackground()); 72 bar.setForeground(colors.getForeground()); 73 parent.setBackground(colors.getBackground()); 74 parent.setForeground(colors.getForeground()); 75 return bar; 76 } 77 78 private void setChildColors(Composite parent) { 79 Control[] children = parent.getChildren(); 80 for (int i = 0; i < children.length; i++) { 81 Control child = children[i]; 82 child.setBackground(colors.getBackground()); 83 if (child instanceof ProgressMonitorPart) 84 setChildColors((ProgressMonitorPart) child); 85 if (child instanceof Composite) { 86 Layout l = ((Composite) child).getLayout(); 87 if (l instanceof PageContainerFillLayout) { 88 PageContainerFillLayout pl = (PageContainerFillLayout) l; 89 pl.marginWidth = 0; 90 pl.marginHeight = 0; 91 } 92 } 93 } 94 } 95 } 96 | Popular Tags |