Skip to content

Commit bf5c29a

Browse files
author
zhourenjian
committed
Enable custom widget examples
1 parent 232ce43 commit bf5c29a

File tree

5 files changed

+61
-46
lines changed

5 files changed

+61
-46
lines changed

tests/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CComboTab.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CComboTab extends Tab {
3838
/**
3939
* Creates the Tab within a given instance of ControlExample.
4040
*/
41-
CComboTab(ControlExample instance) {
41+
public CComboTab(ControlExample instance) {
4242
super(instance);
4343
}
4444

tests/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57,36 +57,7 @@ public class ControlExample {
5757
public ControlExample(Composite parent) {
5858
initResources();
5959
tabFolder = new TabFolder (parent, SWT.NONE);
60-
String[] tabs = new String[] {
61-
// "Table",
62-
"Button",
63-
// "Canvas",
64-
// "CLabel",
65-
66-
"Combo",
67-
68-
"CoolBar",
69-
// "CTabFolder",
70-
"Dialog",
71-
"Group",
72-
"Label",
73-
"Link",
74-
"List",
75-
"Menu",
76-
"ProgressBar",
77-
78-
"Sash",
79-
"SashForm",
80-
// shellTab = new ShellTab(this),
81-
"Shell",
82-
"Slider",
83-
"Spinner",
84-
"TabFolder",
85-
"Table",
86-
"Text",
87-
"ToolBar",
88-
"Tree"
89-
};
60+
String[] tabs = getTabs();
9061
for (int i=0; i<tabs.length; i++) {
9162
TabItem item = new TabItem (tabFolder, SWT.NONE);
9263
item.setText (tabs [i]);
@@ -198,6 +169,40 @@ public void widgetSelected(SelectionEvent e) {
198169
startup = false;
199170
}
200171

172+
String[] getTabs() {
173+
String[] tabs = new String[] {
174+
// "Table",
175+
"Button",
176+
// "Canvas",
177+
// "CLabel",
178+
179+
"Combo",
180+
181+
"CoolBar",
182+
// "CTabFolder",
183+
"Dialog",
184+
"Group",
185+
"Label",
186+
"Link",
187+
"List",
188+
"Menu",
189+
"ProgressBar",
190+
191+
"Sash",
192+
"SashForm",
193+
// shellTab = new ShellTab(this),
194+
"Shell",
195+
"Slider",
196+
"Spinner",
197+
"TabFolder",
198+
"Table",
199+
"Text",
200+
"ToolBar",
201+
"Tree"
202+
};
203+
return tabs;
204+
}
205+
201206
/**
202207
* Answers the set of example Tabs
203208
*/

tests/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CustomControlExample.java

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,31 @@ public CustomControlExample(Composite parent) {
2626
super (parent);
2727
}
2828

29-
/**
30-
* Answers the set of example Tabs
31-
*/
32-
Tab[] createTabs() {
33-
return new Tab [] {
34-
new CComboTab (this),
35-
new CLabelTab (this),
36-
new CTabFolderTab (this),
37-
new SashFormTab (this),
38-
new StyledTextTab (this),
29+
// /**
30+
// * Answers the set of example Tabs
31+
// */
32+
// Tab[] createTabs() {
33+
// return new Tab [] {
34+
// new CComboTab (this),
35+
// new CLabelTab (this),
36+
// new CTabFolderTab (this),
37+
// new SashFormTab (this),
38+
// new StyledTextTab (this),
39+
// };
40+
// }
41+
//
42+
@Override
43+
String[] getTabs() {
44+
String[] tabs = new String[] {
45+
"CLabel",
46+
"CCombo",
47+
"CTabFolder",
48+
"SashForm",
49+
"StyledText"
3950
};
51+
return tabs;
4052
}
41-
53+
4254
/**
4355
* Invokes as a standalone program.
4456
*/
@@ -48,7 +60,7 @@ public static void main(String[] args) {
4860
shell.setLayout(new FillLayout());
4961
CustomControlExample instance = new CustomControlExample(shell);
5062
shell.setText(getResourceString("custom.window.title"));
51-
setShellSize(display, shell);
63+
//setShellSize(display, shell);
5264
shell.open();
5365
while (! shell.isDisposed()) {
5466
if (! display.readAndDispatch()) display.sleep();

tests/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/StyledTextTab.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class StyledTextTab extends ScrollableTab {
3737
/**
3838
* Creates the Tab within a given instance of ControlExample.
3939
*/
40-
StyledTextTab(ControlExample instance) {
40+
public StyledTextTab(ControlExample instance) {
4141
super(instance);
4242
}
4343

tests/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,6 @@ void disposeExampleWidgets () {
819819
/**
820820
* @param image
821821
* @param color
822-
*
823-
* @j2sNative
824822
*/
825823
void drawImage (Image image, Color color) {
826824
GC gc = new GC(image);

0 commit comments

Comments
 (0)