View | Details | Raw Unified | Return to bug 242163 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/swt/examples/controlexample/TextTab.java (-4 / +4 lines)
Lines 108-115 Link Here
108
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
108
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
109
	 * @return the new page for the tab folder
109
	 * @return the new page for the tab folder
110
	 */
110
	 */
111
	Composite createTabFolderPage (TabFolder tabFolder) {
111
	Composite createPageComposite (Composite parent) {
112
		super.createTabFolderPage (tabFolder);
112
		Composite c = super.createPageComposite (parent);
113
113
114
		/*
114
		/*
115
		 * Add a resize listener to the tabFolderPage so that
115
		 * Add a resize listener to the tabFolderPage so that
Lines 117-129 Link Here
117
		 * its preferred size, and then resizes the shell, we
117
		 * its preferred size, and then resizes the shell, we
118
		 * recalculate the preferred size correctly.
118
		 * recalculate the preferred size correctly.
119
		 */
119
		 */
120
		tabFolderPage.addControlListener(new ControlAdapter() {
120
		c.addControlListener(new ControlAdapter() {
121
			public void controlResized(ControlEvent e) {
121
			public void controlResized(ControlEvent e) {
122
				setExampleWidgetSize ();
122
				setExampleWidgetSize ();
123
			}
123
			}
124
		});
124
		});
125
		
125
		
126
		return tabFolderPage;
126
		return c;
127
	}
127
	}
128
128
129
	/**
129
	/**
(-)src/org/eclipse/swt/examples/controlexample/ShellTab.java (-1 / +1 lines)
Lines 118-124 Link Here
118
		 * right half of each example tab.  It consists of the
118
		 * right half of each example tab.  It consists of the
119
		 * style group, the 'other' group and the size group.
119
		 * style group, the 'other' group and the size group.
120
		 */		
120
		 */		
121
		controlGroup = new Group (tabFolderPage, SWT.NONE);
121
		controlGroup = new Group (pageComposite, SWT.NONE);
122
		controlGroup.setLayout (new GridLayout (2, true));
122
		controlGroup.setLayout (new GridLayout (2, true));
123
		controlGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
123
		controlGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
124
		controlGroup.setText (ControlExample.getResourceString("Parameters"));
124
		controlGroup.setText (ControlExample.getResourceString("Parameters"));
(-)src/org/eclipse/swt/examples/controlexample/MenuTab.java (-1 / +1 lines)
Lines 125-131 Link Here
125
		 * right half of each example tab.  For MenuTab, it consists of
125
		 * right half of each example tab.  For MenuTab, it consists of
126
		 * the Menu style group, the MenuItem style group and the 'other' group.
126
		 * the Menu style group, the MenuItem style group and the 'other' group.
127
		 */		
127
		 */		
128
		controlGroup = new Group (tabFolderPage, SWT.NONE);
128
		controlGroup = new Group (pageComposite, SWT.NONE);
129
		controlGroup.setLayout (new GridLayout (2, true));
129
		controlGroup.setLayout (new GridLayout (2, true));
130
		controlGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
130
		controlGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
131
		controlGroup.setText (ControlExample.getResourceString("Parameters"));
131
		controlGroup.setText (ControlExample.getResourceString("Parameters"));
(-)src/org/eclipse/swt/examples/controlexample/ToolTipTab.java (-4 / +4 lines)
Lines 82-89 Link Here
82
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
82
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
83
	 * @return the new page for the tab folder
83
	 * @return the new page for the tab folder
84
	 */
84
	 */
85
	Composite createTabFolderPage (TabFolder tabFolder) {
85
	Composite createPageComposite (Composite parent) {
86
		super.createTabFolderPage (tabFolder);
86
		Composite c = super.createPageComposite (parent);
87
87
88
		/*
88
		/*
89
		 * Add a resize listener to the tabFolderPage so that
89
		 * Add a resize listener to the tabFolderPage so that
Lines 91-103 Link Here
91
		 * its preferred size, and then resizes the shell, we
91
		 * its preferred size, and then resizes the shell, we
92
		 * recalculate the preferred size correctly.
92
		 * recalculate the preferred size correctly.
93
		 */
93
		 */
94
		tabFolderPage.addControlListener(new ControlAdapter() {
94
		c.addControlListener(new ControlAdapter() {
95
			public void controlResized(ControlEvent e) {
95
			public void controlResized(ControlEvent e) {
96
				setExampleWidgetSize ();
96
				setExampleWidgetSize ();
97
			}
97
			}
98
		});
98
		});
99
		
99
		
100
		return tabFolderPage;
100
		return c;
101
	}
101
	}
102
102
103
	/**
103
	/**
(-)src/org/eclipse/swt/examples/controlexample/StyledTextTab.java (-4 / +4 lines)
Lines 262-269 Link Here
262
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
262
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
263
	 * @return the new page for the tab folder
263
	 * @return the new page for the tab folder
264
	 */
264
	 */
265
	Composite createTabFolderPage (TabFolder tabFolder) {
265
	Composite createPageComposite (Composite parent) {
266
		super.createTabFolderPage (tabFolder);
266
		Composite c = super.createPageComposite (parent);
267
267
268
		/*
268
		/*
269
		 * Add a resize listener to the tabFolderPage so that
269
		 * Add a resize listener to the tabFolderPage so that
Lines 271-283 Link Here
271
		 * its preferred size, and then resizes the shell, we
271
		 * its preferred size, and then resizes the shell, we
272
		 * recalculate the preferred size correctly.
272
		 * recalculate the preferred size correctly.
273
		 */
273
		 */
274
		tabFolderPage.addControlListener(new ControlAdapter() {
274
		c.addControlListener(new ControlAdapter() {
275
			public void controlResized(ControlEvent e) {
275
			public void controlResized(ControlEvent e) {
276
				setExampleWidgetSize ();
276
				setExampleWidgetSize ();
277
			}
277
			}
278
		});
278
		});
279
		
279
		
280
		return tabFolderPage;
280
		return c;
281
	}
281
	}
282
282
283
	/**
283
	/**
(-)src/org/eclipse/swt/examples/controlexample/ComboTab.java (-4 / +4 lines)
Lines 80-87 Link Here
80
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
80
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
81
	 * @return the new page for the tab folder
81
	 * @return the new page for the tab folder
82
	 */
82
	 */
83
	Composite createTabFolderPage (TabFolder tabFolder) {
83
	Composite createPageComposite (Composite parent) {
84
		super.createTabFolderPage (tabFolder);
84
		Composite c = super.createPageComposite (parent);
85
85
86
		/*
86
		/*
87
		 * Add a resize listener to the tabFolderPage so that
87
		 * Add a resize listener to the tabFolderPage so that
Lines 89-101 Link Here
89
		 * its preferred size, and then resizes the shell, we
89
		 * its preferred size, and then resizes the shell, we
90
		 * recalculate the preferred size correctly.
90
		 * recalculate the preferred size correctly.
91
		 */
91
		 */
92
		tabFolderPage.addControlListener(new ControlAdapter() {
92
		c.addControlListener(new ControlAdapter() {
93
			public void controlResized(ControlEvent e) {
93
			public void controlResized(ControlEvent e) {
94
				setExampleWidgetSize ();
94
				setExampleWidgetSize ();
95
			}
95
			}
96
		});
96
		});
97
		
97
		
98
		return tabFolderPage;
98
		return c;
99
	}
99
	}
100
100
101
	/**
101
	/**
(-)src/org/eclipse/swt/examples/controlexample/BrowserTab.java (-17 / +18 lines)
Lines 154-161 Link Here
154
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
154
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
155
	 * @return the new page for the tab folder
155
	 * @return the new page for the tab folder
156
	 */
156
	 */
157
	Composite createTabFolderPage (final TabFolder tabFolder) {
157
	Composite createPageComposite (final Composite parent) {
158
		super.createTabFolderPage (tabFolder);
158
		Composite c = super.createPageComposite (parent);
159
159
160
		/*
160
		/*
161
		 * Add a resize listener to the tabFolderPage so that
161
		 * Add a resize listener to the tabFolderPage so that
Lines 163-191 Link Here
163
		 * its preferred size, and then resizes the shell, we
163
		 * its preferred size, and then resizes the shell, we
164
		 * recalculate the preferred size correctly.
164
		 * recalculate the preferred size correctly.
165
		 */
165
		 */
166
		tabFolderPage.addControlListener(new ControlAdapter() {
166
		c.addControlListener(new ControlAdapter() {
167
			public void controlResized(ControlEvent e) {
167
			public void controlResized(ControlEvent e) {
168
				setExampleWidgetSize ();
168
				setExampleWidgetSize ();
169
			}
169
			}
170
		});
170
		});
171
		
171
		
172
		return c;
173
	}
174
175
	/* (non-Javadoc)
176
	 * @see org.eclipse.swt.examples.controlexample.Tab#activated()
177
	 */
178
	public void activated() {
179
		super.activated();
172
		/*
180
		/*
173
		 * Add a selection listener to the tabFolder to bring up a
181
		 * Bring up a dialog if this platform does not support the Browser.
174
		 * dialog if this platform does not support the Browser.
175
		 */
182
		 */
176
		tabFolder.addSelectionListener(new SelectionAdapter() {
183
		if (errorMessage != null) {
177
			public void widgetSelected(SelectionEvent e) {
184
			MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
178
				if (errorMessage != null && tabFolder.getSelection()[0].getText().equals(getTabText())) {
185
			dialog.setMessage(ControlExample.getResourceString("BrowserNotFound", new String [] {errorMessage}));
179
					MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
186
			dialog.open();
180
					dialog.setMessage(ControlExample.getResourceString("BrowserNotFound", new String [] {errorMessage}));
187
		}
181
					dialog.open();
182
				}
183
			}
184
		});
185
		
186
		return tabFolderPage;
187
	}
188
	}
188
189
	
189
	/**
190
	/**
190
	 * Disposes the "Example" widgets.
191
	 * Disposes the "Example" widgets.
191
	 */
192
	 */
(-)src/org/eclipse/swt/examples/controlexample/DialogTab.java (-1 / +1 lines)
Lines 238-244 Link Here
238
		 * right half of each example tab.  It consists of the
238
		 * right half of each example tab.  It consists of the
239
		 * style group, the display group and the size group.
239
		 * style group, the display group and the size group.
240
		 */			
240
		 */			
241
		controlGroup = new Group (tabFolderPage, SWT.NONE);
241
		controlGroup = new Group (pageComposite, SWT.NONE);
242
		GridLayout gridLayout= new GridLayout ();
242
		GridLayout gridLayout= new GridLayout ();
243
		controlGroup.setLayout(gridLayout);
243
		controlGroup.setLayout(gridLayout);
244
		gridLayout.numColumns = 2;
244
		gridLayout.numColumns = 2;
(-)src/org/eclipse/swt/examples/controlexample/CanvasTab.java (-5 / +5 lines)
Lines 184-205 Link Here
184
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
184
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
185
	 * @return the new page for the tab folder
185
	 * @return the new page for the tab folder
186
	 */
186
	 */
187
	Composite createTabFolderPage (TabFolder tabFolder) {
187
	Composite createPageComposite (Composite parent) {
188
		super.createTabFolderPage (tabFolder);
188
		Composite c = super.createPageComposite (parent);
189
189
190
		/*
190
		/*
191
		 * Add a resize listener to the tabFolderPage so that
191
		 * Add a resize listener to the Composite so that
192
		 * if the user types into the example widget to change
192
		 * if the user types into the example widget to change
193
		 * its preferred size, and then resizes the shell, we
193
		 * its preferred size, and then resizes the shell, we
194
		 * recalculate the preferred size correctly.
194
		 * recalculate the preferred size correctly.
195
		 */
195
		 */
196
		tabFolderPage.addControlListener(new ControlAdapter() {
196
		c.addControlListener(new ControlAdapter() {
197
			public void controlResized(ControlEvent e) {
197
			public void controlResized(ControlEvent e) {
198
				setExampleWidgetSize ();
198
				setExampleWidgetSize ();
199
			}
199
			}
200
		});
200
		});
201
		
201
		
202
		return tabFolderPage;
202
		return c;
203
	}
203
	}
204
204
205
	/**
205
	/**
(-)src/org/eclipse/swt/examples/controlexample/SpinnerTab.java (-4 / +4 lines)
Lines 163-170 Link Here
163
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
163
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
164
	 * @return the new page for the tab folder
164
	 * @return the new page for the tab folder
165
	 */
165
	 */
166
	Composite createTabFolderPage (TabFolder tabFolder) {
166
	Composite createPageComposite (Composite parent) {
167
		super.createTabFolderPage (tabFolder);
167
		Composite c = super.createPageComposite (parent);
168
168
169
		/*
169
		/*
170
		 * Add a resize listener to the tabFolderPage so that
170
		 * Add a resize listener to the tabFolderPage so that
Lines 172-184 Link Here
172
		 * its preferred size, and then resizes the shell, we
172
		 * its preferred size, and then resizes the shell, we
173
		 * recalculate the preferred size correctly.
173
		 * recalculate the preferred size correctly.
174
		 */
174
		 */
175
		tabFolderPage.addControlListener(new ControlAdapter() {
175
		c.addControlListener(new ControlAdapter() {
176
			public void controlResized(ControlEvent e) {
176
			public void controlResized(ControlEvent e) {
177
				setExampleWidgetSize ();
177
				setExampleWidgetSize ();
178
			}
178
			}
179
		});
179
		});
180
		
180
		
181
		return tabFolderPage;
181
		return c;
182
	}
182
	}
183
183
184
	/**
184
	/**
(-)src/org/eclipse/swt/examples/controlexample/ControlExample.java (-22 / +67 lines)
Lines 12-17 Link Here
12
12
13
13
14
import org.eclipse.swt.*;
14
import org.eclipse.swt.*;
15
import org.eclipse.swt.custom.StackLayout;
16
import org.eclipse.swt.events.SelectionAdapter;
17
import org.eclipse.swt.events.SelectionEvent;
15
import org.eclipse.swt.graphics.*;
18
import org.eclipse.swt.graphics.*;
16
import org.eclipse.swt.layout.*;
19
import org.eclipse.swt.layout.*;
17
import org.eclipse.swt.widgets.*;
20
import org.eclipse.swt.widgets.*;
Lines 24-31 Link Here
24
	private static ResourceBundle resourceBundle =
27
	private static ResourceBundle resourceBundle =
25
		ResourceBundle.getBundle("examples_control"); //$NON-NLS-1$
28
		ResourceBundle.getBundle("examples_control"); //$NON-NLS-1$
26
	private ShellTab shellTab;
29
	private ShellTab shellTab;
27
	private TabFolder tabFolder;
30
	private Combo tabCombo;
31
	private Composite tabArea;
32
	private StackLayout tabLayout;
28
	private Tab [] tabs;
33
	private Tab [] tabs;
34
	private Composite[] tabPages;
29
	Image images[];
35
	Image images[];
30
36
31
	static final int ciClosedFolder = 0, ciOpenFolder = 1, ciTarget = 2, ciBackground = 3, ciParentBackground = 4;
37
	static final int ciClosedFolder = 0, ciOpenFolder = 1, ciTarget = 2, ciBackground = 3, ciParentBackground = 4;
Lines 52-65 Link Here
52
	 */
58
	 */
53
	public ControlExample(Composite parent) {
59
	public ControlExample(Composite parent) {
54
		initResources();
60
		initResources();
55
		tabFolder = new TabFolder (parent, SWT.NONE);
56
		tabs = createTabs();
61
		tabs = createTabs();
57
		for (int i=0; i<tabs.length; i++) {
62
		
58
			TabItem item = new TabItem (tabFolder, SWT.NONE);
63
		String comboEntries[] = new String[tabs.length];
59
		    item.setText (tabs [i].getTabText ());
64
		for (int i = 0; i < tabs.length; i++) {
60
		    item.setControl (tabs [i].createTabFolderPage (tabFolder));
65
			comboEntries[i] = tabs[i].getTabText();
61
		    item.setData (tabs [i]);
62
		}
66
		}
67
		
68
		Composite top = new Composite(parent, SWT.NONE);
69
		top.setLayout(new GridLayout(2, false));
70
		
71
		Label tabLabel = new Label(top, SWT.NONE);
72
		tabLabel.setText("Control");
73
		tabLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
74
		
75
		tabCombo = new Combo(top, SWT.READ_ONLY);
76
		tabCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
77
		tabCombo.setItems(comboEntries);
78
		tabCombo.addSelectionListener(new SelectionAdapter() {
79
			public void widgetSelected(SelectionEvent e) {
80
				selectTab(tabCombo.getSelectionIndex());
81
			}
82
		});
83
		
84
		tabLayout = new StackLayout();
85
		tabArea = new Composite(top, SWT.NONE);
86
		tabArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
87
		tabArea.setLayout(tabLayout);
88
		tabPages = new Composite[tabs.length];
89
		for (int i = 0; i < tabs.length; i++) {
90
			tabPages[i] = tabs[i].createPageComposite(tabArea);
91
		}
92
93
		tabCombo.select(0);
94
		tabLayout.topControl = tabPages[0];
95
		tabArea.layout();
96
		
63
		startup = false;
97
		startup = false;
64
	}
98
	}
65
99
Lines 73-79 Link Here
73
			new ComboTab (this),
107
			new ComboTab (this),
74
			new CoolBarTab (this),
108
			new CoolBarTab (this),
75
			new DateTimeTab (this),
109
			new DateTimeTab (this),
76
			new DialogTab (this),
110
			new DialogTab (this), 
77
			new ExpandBarTab (this),
111
			new ExpandBarTab (this),
78
			new GroupTab (this),
112
			new GroupTab (this),
79
			new LabelTab (this),
113
			new LabelTab (this),
Lines 83-96 Link Here
83
			new ProgressBarTab (this),
117
			new ProgressBarTab (this),
84
			new SashTab (this),
118
			new SashTab (this),
85
			new ScaleTab (this),
119
			new ScaleTab (this),
86
			shellTab = new ShellTab(this),
120
			shellTab = new ShellTab(this), 
87
			new SliderTab (this),
121
			new SliderTab (this),
88
			new SpinnerTab (this),
122
			new SpinnerTab (this), 
89
			new TabFolderTab (this),
123
			new TabFolderTab (this),
90
			new TableTab (this),
124
			new TableTab (this),
91
			new TextTab (this),
125
			new TextTab (this), 
92
			new ToolBarTab (this),
126
			new ToolBarTab (this),
93
			new ToolTipTab (this),
127
			new ToolTipTab (this), 
94
			new TreeTab (this),
128
			new TreeTab (this),
95
			new BrowserTab (this),
129
			new BrowserTab (this),
96
		};
130
		};
Lines 111-117 Link Here
111
		 */
145
		 */
112
		if (shellTab != null) shellTab.closeAllShells ();
146
		if (shellTab != null) shellTab.closeAllShells ();
113
		shellTab = null;
147
		shellTab = null;
114
		tabFolder = null;
148
		tabArea = null;
149
		tabCombo = null;
115
		freeResources();
150
		freeResources();
116
	}
151
	}
117
152
Lines 214-223 Link Here
214
	}
249
	}
215
	
250
	
216
	/**
251
	/**
252
	 * Changes the tab displayed in the group.
253
	 * @param index the index of the tab in tabs[]
254
	 */
255
	void selectTab(int index) {
256
		tabLayout.topControl = tabPages[index];
257
		tabArea.layout();
258
		tabs[index].activated();
259
	}
260
	
261
	/**
217
	 * Grabs input focus.
262
	 * Grabs input focus.
218
	 */
263
	 */
219
	public void setFocus() {
264
	public void setFocus() {
220
		tabFolder.setFocus();
265
		tabCombo.setFocus();
221
	}
266
	}
222
	
267
	
223
	/**
268
	/**
Lines 231-244 Link Here
231
		/* Workaround: if the tab folder is wider than the screen,
276
		/* Workaround: if the tab folder is wider than the screen,
232
		 * carbon clips instead of somehow scrolling the tab items.
277
		 * carbon clips instead of somehow scrolling the tab items.
233
		 * We try to recover some width by using shorter tab names. */
278
		 * We try to recover some width by using shorter tab names. */
234
		if (size.x > monitorArea.width && SWT.getPlatform().equals("carbon")) {
279
//		if (size.x > monitorArea.width && SWT.getPlatform().equals("carbon")) {
235
			TabItem [] tabItems = instance.tabFolder.getItems();
280
//			TabItem [] tabItems = instance.tabFolder.getItems();
236
			for (int i=0; i<tabItems.length; i++) {
281
//			for (int i=0; i<tabItems.length; i++) {
237
				tabItems[i].setText (instance.tabs [i].getShortTabText ());
282
//				tabItems[i].setText (instance.tabs [i].getShortTabText ());
238
			}
283
//			}
239
			size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
284
//			size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
240
		}
285
//		}
241
		shell.setSize(Math.min(size.x, monitorArea.width), Math.min(size.y, monitorArea.height));
286
//		shell.setSize(Math.min(size.x, monitorArea.width), Math.min(size.y, monitorArea.height));
242
	}
287
	}
243
}
288
}
244
289
(-)src/org/eclipse/swt/examples/controlexample/Tab.java (-28 / +37 lines)
Lines 44-50 Link Here
44
	Button preferredButton, tooSmallButton, smallButton, largeButton, fillHButton, fillVButton;
44
	Button preferredButton, tooSmallButton, smallButton, largeButton, fillHButton, fillVButton;
45
45
46
	/* Common groups and composites */
46
	/* Common groups and composites */
47
	Composite tabFolderPage;
47
	Composite pageComposite;
48
	Group exampleGroup, controlGroup, listenersGroup, otherGroup, sizeGroup, styleGroup, colorGroup, backgroundModeGroup;
48
	Group exampleGroup, controlGroup, listenersGroup, otherGroup, sizeGroup, styleGroup, colorGroup, backgroundModeGroup;
49
49
50
	/* Controlling instance */
50
	/* Controlling instance */
Lines 231-237 Link Here
231
		 * right half of each example tab.  It consists of the
231
		 * right half of each example tab.  It consists of the
232
		 * "Style" group, the "Other" group and the "Size" group.
232
		 * "Style" group, the "Other" group and the "Size" group.
233
		 */	
233
		 */	
234
		controlGroup = new Group (tabFolderPage, SWT.NONE);
234
		controlGroup = new Group (pageComposite, SWT.NONE);
235
		controlGroup.setLayout (new GridLayout (2, true));
235
		controlGroup.setLayout (new GridLayout (2, true));
236
		controlGroup.setLayoutData (new GridData(SWT.FILL, SWT.FILL, false, false));
236
		controlGroup.setLayoutData (new GridData(SWT.FILL, SWT.FILL, false, false));
237
		controlGroup.setText (ControlExample.getResourceString("Parameters"));
237
		controlGroup.setText (ControlExample.getResourceString("Parameters"));
Lines 762-768 Link Here
762
	 * is typically the left hand column in the tab.
762
	 * is typically the left hand column in the tab.
763
	 */
763
	 */
764
	void createExampleGroup () {
764
	void createExampleGroup () {
765
		exampleGroup = new Group (tabFolderPage, SWT.NONE);
765
		exampleGroup = new Group (pageComposite, SWT.NONE);
766
		exampleGroup.setLayout (new GridLayout ());
766
		exampleGroup.setLayout (new GridLayout ());
767
		exampleGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, true, true));
767
		exampleGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, true, true));
768
	}
768
	}
Lines 901-907 Link Here
901
	 * goes below the "Example" and "Control" groups.
901
	 * goes below the "Example" and "Control" groups.
902
	 */
902
	 */
903
	void createListenersGroup () {
903
	void createListenersGroup () {
904
		listenersGroup = new Group (tabFolderPage, SWT.NONE);
904
		listenersGroup = new Group (pageComposite, SWT.NONE);
905
		listenersGroup.setLayout (new GridLayout (3, false));
905
		listenersGroup.setLayout (new GridLayout (3, false));
906
		listenersGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, true, true, 2, 1));
906
		listenersGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, true, true, 2, 1));
907
		listenersGroup.setText (ControlExample.getResourceString ("Listeners"));
907
		listenersGroup.setText (ControlExample.getResourceString ("Listeners"));
Lines 1238-1267 Link Here
1238
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
1238
	 * @param tabFolder org.eclipse.swt.widgets.TabFolder
1239
	 * @return the new page for the tab folder
1239
	 * @return the new page for the tab folder
1240
	 */
1240
	 */
1241
	Composite createTabFolderPage (TabFolder tabFolder) {
1241
	Composite createPageComposite(Composite parent) {
1242
		/* Cache the shell and display. */
1242
		if (pageComposite == null) {
1243
		shell = tabFolder.getShell ();
1243
			/* Cache the shell and display. */
1244
		display = shell.getDisplay ();
1244
			shell = parent.getShell ();
1245
		
1245
			display = shell.getDisplay ();
1246
		/* Create a two column page. */
1246
1247
		tabFolderPage = new Composite (tabFolder, SWT.NONE);
1247
			/* Create a two column page. */
1248
		tabFolderPage.setLayout (new GridLayout (2, false));
1248
			pageComposite = new Composite (parent, SWT.NONE);
1249
	
1249
			pageComposite.setLayout (new GridLayout (2, false));
1250
		/* Create the "Example" and "Control" groups. */
1250
1251
		createExampleGroup ();
1251
			/* Create the "Example" and "Control" groups. */
1252
		createControlGroup ();
1252
			createExampleGroup ();
1253
		
1253
			createControlGroup ();
1254
		/* Create the "Listeners" group under the "Control" group. */
1254
1255
		createListenersGroup ();
1255
			/* Create the "Listeners" group under the "Control" group. */
1256
		
1256
			createListenersGroup ();
1257
		/* Create and initialize the example and control widgets. */
1257
1258
		createExampleWidgets ();
1258
			/* Create and initialize the example and control widgets. */
1259
		hookExampleWidgetListeners ();
1259
			createExampleWidgets ();
1260
		createControlWidgets ();
1260
			hookExampleWidgetListeners ();
1261
		createBackgroundModeGroup ();
1261
			createControlWidgets ();
1262
		setExampleWidgetState ();
1262
			createBackgroundModeGroup ();
1263
			setExampleWidgetState ();
1264
		}
1263
		
1265
		
1264
		return tabFolderPage;
1266
		return pageComposite;
1265
	}
1267
	}
1266
	
1268
	
1267
	void setExampleWidgetPopupMenu() {
1269
	void setExampleWidgetPopupMenu() {
Lines 1734-1740 Link Here
1734
			gridData.verticalAlignment = fillVButton.getSelection() ? SWT.FILL : SWT.TOP;
1736
			gridData.verticalAlignment = fillVButton.getSelection() ? SWT.FILL : SWT.TOP;
1735
			controls [i].setLayoutData (gridData);
1737
			controls [i].setLayoutData (gridData);
1736
		}
1738
		}
1737
		tabFolderPage.layout (controls);
1739
		pageComposite.layout (controls);
1738
	}
1740
	}
1739
	
1741
	
1740
	/**
1742
	/**
Lines 1806-1809 Link Here
1806
		}
1808
		}
1807
		return result;
1809
		return result;
1808
	}
1810
	}
1811
1812
	/**
1813
	 * This is called by the parent view when the tab is activated. 
1814
	 */
1815
	public void activated() {
1816
		// default implementation does nothing		
1817
	}
1809
}
1818
}

Return to bug 242163