1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
protected Control createDialogArea(Composite parent) {
// brand the about box if there is product info
Image aboutImage = null;
if (product != null) {
ImageDescriptor imageDescriptor = ProductProperties.getAboutImage(product);
if (imageDescriptor != null) {
aboutImage = imageDescriptor.createImage();
}
// create a composite which is the parent of the top area and the bottom
// button bar, this allows there to be a second child of this composite with
// a banner background on top but not have on the bottom
Composite workArea = new Composite(parent, SWT.NONE);
GridLayout workLayout = new GridLayout();
workLayout.marginHeight = 0;
workLayout.marginWidth = 0;
workLayout.verticalSpacing = 0;
workLayout.horizontalSpacing = 0;
workArea.setLayout(workLayout);
workArea.setLayoutData(new GridData(GridData.FILL_BOTH));
// page group
Color background = JFaceColors.getBannerBackground(parent.getDisplay());
Color foreground = JFaceColors.getBannerForeground(parent.getDisplay());
Composite top = (Composite) super.createDialogArea(workArea);
// override any layout inherited from createDialogArea
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
top.setLayout(layout);
top.setLayoutData(new GridData(GridData.FILL_BOTH));
top.setBackground(background);
top.setForeground(foreground);
// the image & text
Composite topContainer = new Composite(top, SWT.NONE);
topContainer.setBackground(background);
topContainer.setForeground(foreground);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
topContainer.setLayout(layout);
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
topContainer.setLayoutData(data);
//image on left side of dialog
if (aboutImage != null) {
Label imageLabel = new Label(topContainer, SWT.NONE);
imageLabel.setBackground(background);
imageLabel.setForeground(foreground);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.BEGINNING;
data.grabExcessHorizontalSpace = false;
imageLabel.setLayoutData(data);
imageLabel.setImage(aboutImage);
}
// if (getItem() != null) {
// there is no margins around the image, so insert an extra composite
// here to provide some margins for the text.
Composite textContainer = new Composite(topContainer, SWT.NONE);
textContainer.setBackground(background);
textContainer.setForeground(foreground);
layout = new GridLayout();
layout.numColumns = 1;
textContainer.setLayout(layout);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.BEGINNING;
data.grabExcessHorizontalSpace = true;
textContainer.setLayoutData(data);
// text on the right
text = new StyledText(textContainer, SWT.MULTI | SWT.READ_ONLY);
text.setCaret(null);
text.setFont(parent.getFont());
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.BEGINNING;
data.grabExcessHorizontalSpace = true;
//data.heightHint = 147;
text.setText(item);
text.setLayoutData(data);
text.setCursor(null);
text.setBackground(background);
text.setForeground(foreground);
// horizontal bar
Label bar = new Label(workArea, SWT.HORIZONTAL | SWT.SEPARATOR);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
bar.setLayoutData(data);
// add image buttons for bundle groups that have them
Composite bottom = (Composite) super.createDialogArea(workArea);
// override any layout inherited from createDialogArea
layout = new GridLayout();
bottom.setLayout(layout);
bottom.setLayoutData(new GridData(GridData.FILL_BOTH));
final Browser browser;
browser = new Browser(bottom, SWT.BORDER);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.BEGINNING;
data.grabExcessHorizontalSpace = true;
data.heightHint = 250;
data.widthHint = 200;
browser.setLayoutData(data);
browser.setUrl("file:///" + fAboutHtml.getPath());
// spacer
bar = new Label(bottom, SWT.NONE);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
bar.setLayoutData(data);
return workArea;
} |
Partager