Lines 18-23
Link Here
|
18 |
import org.eclipse.swt.layout.*; |
18 |
import org.eclipse.swt.layout.*; |
19 |
import org.eclipse.swt.widgets.*; |
19 |
import org.eclipse.swt.widgets.*; |
20 |
import org.eclipse.ui.*; |
20 |
import org.eclipse.ui.*; |
|
|
21 |
import org.eclipse.ui.forms.HyperlinkSettings; |
22 |
import org.eclipse.ui.forms.widgets.FormText; |
21 |
|
23 |
|
22 |
/** |
24 |
/** |
23 |
* Preference page for Tomcat network interface and port. |
25 |
* Preference page for Tomcat network interface and port. |
Lines 38-60
Link Here
|
38 |
|
40 |
|
39 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpUIConstants.PREF_PAGE_APPSERVER); |
41 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpUIConstants.PREF_PAGE_APPSERVER); |
40 |
|
42 |
|
41 |
Composite mainComposite = new Composite(parent, SWT.NULL); |
43 |
final Composite mainComposite = new Composite(parent, SWT.NULL); |
42 |
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
44 |
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
43 |
GridLayout layout = new GridLayout(); |
45 |
final GridLayout layout = new GridLayout(); |
44 |
layout.marginHeight = 0; |
46 |
layout.marginHeight = 0; |
45 |
layout.marginWidth = 0; |
47 |
layout.marginWidth = 0; |
46 |
layout.numColumns = 2; |
48 |
layout.numColumns = 2; |
47 |
mainComposite.setLayout(layout); |
49 |
mainComposite.setLayout(layout); |
48 |
|
50 |
|
49 |
Label label = new Label(mainComposite, SWT.NONE); |
51 |
final Label descLabel = new Label(mainComposite, SWT.WRAP); |
50 |
label.setText(Messages.AppserverPreferencePage_description); //$NON-NLS-1$ |
52 |
descLabel.setText(Messages.AppserverPreferencePage_description); //$NON-NLS-1$ |
51 |
GridData data = new GridData(); |
53 |
GridData data = new GridData(); |
52 |
data.horizontalSpan = 2; |
54 |
data.horizontalSpan = 2; |
53 |
label.setLayoutData(data); |
55 |
data.widthHint = 100; |
54 |
label.setFont(font); |
56 |
descLabel.setLayoutData(data); |
|
|
57 |
descLabel.setFont(font); |
55 |
|
58 |
|
56 |
// Spacer |
59 |
// Spacer |
57 |
label = new Label(mainComposite, SWT.NONE); |
60 |
Label label = new Label(mainComposite, SWT.NONE); |
58 |
data = new GridData(); |
61 |
data = new GridData(); |
59 |
data.horizontalSpan = 2; |
62 |
data.horizontalSpan = 2; |
60 |
label.setLayoutData(data); |
63 |
label.setLayoutData(data); |
Lines 63-117
Link Here
|
63 |
label = new Label(mainComposite, SWT.NONE); |
66 |
label = new Label(mainComposite, SWT.NONE); |
64 |
label.setFont(font); |
67 |
label.setFont(font); |
65 |
label.setText(Messages.AppserverPreferencePage_hostDescription); //$NON-NLS-1$ |
68 |
label.setText(Messages.AppserverPreferencePage_hostDescription); //$NON-NLS-1$ |
66 |
data = new GridData(); |
|
|
67 |
data.horizontalSpan = 2; |
68 |
label.setLayoutData(data); |
69 |
|
70 |
//Label labelHost = new Label(mainComposite, SWT.LEFT); |
71 |
//labelHost.setText( |
72 |
// WorkbenchResources.getString("AppserverPreferencePage.host")); |
73 |
//data = new GridData(); |
74 |
//labelHost.setLayoutData(data); |
75 |
//labelHost.setFont(font); |
76 |
|
69 |
|
77 |
textServerAddr = new Text(mainComposite, SWT.SINGLE | SWT.BORDER); |
70 |
textServerAddr = new Text(mainComposite, SWT.SINGLE | SWT.BORDER); |
78 |
//text.addListener(SWT.Modify, this); |
71 |
//text.addListener(SWT.Modify, this); |
79 |
data = new GridData(); |
72 |
data = new GridData(GridData.FILL_HORIZONTAL); |
80 |
data.horizontalAlignment = GridData.FILL; |
73 |
data.widthHint = convertWidthInCharsToPixels(8); |
81 |
data.grabExcessHorizontalSpace = true; |
|
|
82 |
data.horizontalSpan = 2; |
83 |
textServerAddr.setLayoutData(data); |
74 |
textServerAddr.setLayoutData(data); |
84 |
textServerAddr.setFont(font); |
75 |
textServerAddr.setFont(font); |
85 |
|
76 |
|
86 |
// Spacer |
|
|
87 |
label = new Label(mainComposite, SWT.NONE); |
88 |
data = new GridData(); |
89 |
data.horizontalSpan = 2; |
90 |
label.setLayoutData(data); |
91 |
label.setFont(font); |
92 |
|
93 |
label = new Label(mainComposite, SWT.NONE); |
77 |
label = new Label(mainComposite, SWT.NONE); |
94 |
label.setFont(font); |
78 |
label.setFont(font); |
95 |
label.setText(Messages.AppserverPreferencePage_portDescription); //$NON-NLS-1$ |
79 |
label.setText(Messages.AppserverPreferencePage_portDescription); //$NON-NLS-1$ |
96 |
data = new GridData(); |
|
|
97 |
data.horizontalSpan = 2; |
98 |
label.setLayoutData(data); |
99 |
label.setFont(font); |
100 |
|
101 |
//Label labelPort = new Label(mainComposite, SWT.LEFT); |
102 |
//labelPort.setText( |
103 |
// WorkbenchResources.getString("AppserverPreferencePage.port")); |
104 |
//data = new GridData(); |
105 |
//labelPort.setLayoutData(data); |
106 |
//labelPort.setFont(font); |
107 |
|
80 |
|
108 |
textServerPort = new Text(mainComposite, SWT.SINGLE | SWT.BORDER); |
81 |
textServerPort = new Text(mainComposite, SWT.SINGLE | SWT.BORDER); |
109 |
textServerPort.setTextLimit(5); |
82 |
textServerPort.setTextLimit(5); |
110 |
data = new GridData(); |
83 |
data = new GridData(GridData.FILL_HORIZONTAL); |
111 |
data.widthHint = convertWidthInCharsToPixels(8); |
84 |
data.widthHint = convertWidthInCharsToPixels(8); |
112 |
data.horizontalAlignment = GridData.FILL; |
|
|
113 |
data.grabExcessHorizontalSpace = true; |
114 |
data.horizontalSpan = 2; |
115 |
textServerPort.setLayoutData(data); |
85 |
textServerPort.setLayoutData(data); |
116 |
textServerPort.setFont(font); |
86 |
textServerPort.setFont(font); |
117 |
|
87 |
|
Lines 147-179
Link Here
|
147 |
data.horizontalSpan = 2; |
117 |
data.horizontalSpan = 2; |
148 |
label.setLayoutData(data); |
118 |
label.setLayoutData(data); |
149 |
label.setFont(font); |
119 |
label.setFont(font); |
150 |
|
120 |
|
151 |
label = new Label(mainComposite, SWT.NONE); |
121 |
FormText ftext = new FormText(mainComposite, SWT.WRAP); |
152 |
label |
122 |
ftext.setText(Messages.AppserverPreferencePage_requireRestart, true, false); |
153 |
.setText(Messages.AppserverPreferencePage_Note); //$NON-NLS-1$ |
123 |
data = new GridData(GridData.GRAB_HORIZONTAL); |
154 |
// Make this bold |
124 |
ftext.setHyperlinkSettings(new HyperlinkSettings(mainComposite.getDisplay())); |
155 |
FontData[] fontData = font.getFontData(); |
125 |
data.horizontalSpan = 2; |
156 |
for (int i = 0; i < fontData.length; i++) { |
126 |
data.widthHint = 100; |
157 |
fontData[i].setStyle(fontData[i].getStyle() | SWT.BOLD); |
127 |
ftext.setLayoutData(data); |
158 |
} |
128 |
ftext.setFont(font); |
159 |
final Font boldFont = new Font(label.getDisplay(), fontData); |
129 |
final GridData fdata = data; |
160 |
label.setFont(boldFont); |
130 |
mainComposite.addControlListener(new ControlAdapter() { |
161 |
label.addDisposeListener(new DisposeListener() { |
131 |
public void controlResized(ControlEvent e) { |
162 |
public void widgetDisposed(DisposeEvent e) { |
132 |
GridData ddata = (GridData)descLabel.getLayoutData(); |
163 |
boldFont.dispose(); |
133 |
int width = mainComposite.getSize().x-layout.marginWidth*2; |
|
|
134 |
fdata.widthHint = width; |
135 |
ddata.widthHint = width; |
136 |
mainComposite.layout(); |
164 |
} |
137 |
} |
165 |
}); |
138 |
}); |
166 |
// |
|
|
167 |
data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); |
168 |
//data.horizontalSpan = 2; |
169 |
label.setLayoutData(data); |
170 |
|
171 |
label = new Label(mainComposite, SWT.NONE); |
172 |
label.setText(Messages.AppserverPreferencePage_requireRestart); //$NON-NLS-1$ |
173 |
data = new GridData(); |
174 |
//data.horizontalSpan = 2; |
175 |
label.setLayoutData(data); |
176 |
label.setFont(font); |
177 |
|
139 |
|
178 |
Preferences pref = AppserverPlugin.getDefault().getPluginPreferences(); |
140 |
Preferences pref = AppserverPlugin.getDefault().getPluginPreferences(); |
179 |
textServerAddr.setText(pref.getString(AppserverPlugin.HOST_KEY)); |
141 |
textServerAddr.setText(pref.getString(AppserverPlugin.HOST_KEY)); |