|
Lines 1-5
Link Here
|
| 1 |
/********************************************************************** |
1 |
/********************************************************************** |
| 2 |
* Copyright (c) 2006, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2006, 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 21-27
Link Here
|
| 21 |
import org.eclipse.swt.SWT; |
21 |
import org.eclipse.swt.SWT; |
| 22 |
import org.eclipse.swt.events.SelectionAdapter; |
22 |
import org.eclipse.swt.events.SelectionAdapter; |
| 23 |
import org.eclipse.swt.events.SelectionEvent; |
23 |
import org.eclipse.swt.events.SelectionEvent; |
| 24 |
import org.eclipse.swt.graphics.Color; |
|
|
| 25 |
import org.eclipse.swt.layout.GridData; |
24 |
import org.eclipse.swt.layout.GridData; |
| 26 |
import org.eclipse.swt.layout.GridLayout; |
25 |
import org.eclipse.swt.layout.GridLayout; |
| 27 |
import org.eclipse.swt.widgets.Button; |
26 |
import org.eclipse.swt.widgets.Button; |
|
Lines 37-51
Link Here
|
| 37 |
* |
36 |
* |
| 38 |
* |
37 |
* |
| 39 |
* @author Paul E. Slauenwhite |
38 |
* @author Paul E. Slauenwhite |
| 40 |
* @version November 15, 2006 |
39 |
* @author Tony Wang |
|
|
40 |
* @version February 28, 2008 |
| 41 |
* @since September 7, 2006 |
41 |
* @since September 7, 2006 |
| 42 |
* @provisional |
42 |
* @provisional |
| 43 |
*/ |
43 |
*/ |
| 44 |
public class TPTPJUnitTestSuiteGenerationPane extends Composite { |
44 |
public class TPTPJUnitTestSuiteGenerationPane extends Composite { |
| 45 |
|
45 |
|
| 46 |
private Text testSuiteLocationText = null; |
46 |
protected Text testSuiteLocationText = null; |
| 47 |
private Combo testSuiteGeneratorCombo = null; |
47 |
protected Combo testSuiteGeneratorCombo = null; |
| 48 |
private Button testSuiteLocationButton = null; |
48 |
protected Button testSuiteLocationButton = null; |
| 49 |
|
49 |
|
| 50 |
public TPTPJUnitTestSuiteGenerationPane(Composite parent){ |
50 |
public TPTPJUnitTestSuiteGenerationPane(Composite parent){ |
| 51 |
this(parent, SWT.SHADOW_NONE); |
51 |
this(parent, SWT.SHADOW_NONE); |
|
Lines 66-85
Link Here
|
| 66 |
return testSuiteLocationText; |
66 |
return testSuiteLocationText; |
| 67 |
} |
67 |
} |
| 68 |
|
68 |
|
| 69 |
public void init(){ |
69 |
protected void buildPane(){ |
| 70 |
|
|
|
| 71 |
testSuiteGeneratorCombo.select(0); |
| 72 |
|
| 73 |
testSuiteLocationText.setEnabled(false); |
| 74 |
testSuiteLocationText.setText(""); |
| 75 |
|
| 76 |
//Work-around: Set the text field's background color to gray since disabled/enabled un-editable text fields have a gray background, by default. |
| 77 |
testSuiteLocationText.setBackground(((Color)(testSuiteGeneratorCombo.getData("Background")))); |
| 78 |
|
| 79 |
testSuiteLocationButton.setEnabled(false); |
| 80 |
} |
| 81 |
|
| 82 |
private void buildPane(){ |
| 83 |
|
70 |
|
| 84 |
setLayout(new GridLayout()); |
71 |
setLayout(new GridLayout()); |
| 85 |
setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
72 |
setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
|
Lines 99-124
Link Here
|
| 99 |
|
86 |
|
| 100 |
testSuiteGeneratorCombo = new Combo(testGroup, SWT.READ_ONLY); |
87 |
testSuiteGeneratorCombo = new Combo(testGroup, SWT.READ_ONLY); |
| 101 |
testSuiteGeneratorCombo.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create()); |
88 |
testSuiteGeneratorCombo.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create()); |
| 102 |
testSuiteGeneratorCombo.add("Do not generate test suite"); |
|
|
| 103 |
testSuiteGeneratorCombo.add("TPTP JUnit Test Suite Generator"); |
89 |
testSuiteGeneratorCombo.add("TPTP JUnit Test Suite Generator"); |
| 104 |
testSuiteGeneratorCombo.addSelectionListener(new SelectionAdapter() { |
90 |
testSuiteGeneratorCombo.select(0); |
| 105 |
|
|
|
| 106 |
public void widgetSelected(SelectionEvent e) { |
| 107 |
|
| 108 |
if(testSuiteGeneratorCombo.getSelectionIndex() != 0){ |
| 109 |
|
| 110 |
testSuiteLocationButton.setEnabled(true); |
| 111 |
|
| 112 |
testSuiteLocationText.setEnabled(true); |
| 113 |
|
| 114 |
//Work-around: Set the text field's background color to white since disabled/enabled un-editable text fields have a gray background, by default. |
| 115 |
testSuiteLocationText.setBackground(testSuiteGeneratorCombo.getBackground()); |
| 116 |
} |
| 117 |
else{ |
| 118 |
init(); |
| 119 |
} |
| 120 |
} |
| 121 |
}); |
| 122 |
|
91 |
|
| 123 |
//TODO: Create extension point for user-defined test suite generators: |
92 |
//TODO: Create extension point for user-defined test suite generators: |
| 124 |
// IConfigurationElement[] elements = |
93 |
// IConfigurationElement[] elements = |
|
Lines 134-142
Link Here
|
| 134 |
testSuiteLocationText = new Text(testGroup, SWT.SINGLE | SWT.BORDER); |
103 |
testSuiteLocationText = new Text(testGroup, SWT.SINGLE | SWT.BORDER); |
| 135 |
testSuiteLocationText.setEditable(false); |
104 |
testSuiteLocationText.setEditable(false); |
| 136 |
testSuiteLocationText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).create()); |
105 |
testSuiteLocationText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).create()); |
| 137 |
|
106 |
|
| 138 |
//Work-around: Persist the text field's background original color since disabled/enabled un-editable text fields have a gray background, by default. |
107 |
//Work-around: Persist the text field's background original color since disabled/enabled un-editable text fields have a gray background, by default. |
| 139 |
testSuiteLocationText.setData("Background",testSuiteLocationText.getBackground()); |
108 |
testSuiteLocationText.setData("Background", testSuiteLocationText.getBackground()); |
|
|
109 |
|
| 110 |
//Work-around: Set the text field's background color to white since disabled/enabled un-editable text fields have a gray background, by default. |
| 111 |
testSuiteLocationText.setBackground(testSuiteGeneratorCombo.getBackground()); |
| 140 |
|
112 |
|
| 141 |
testSuiteLocationButton = new Button(testGroup, SWT.PUSH); |
113 |
testSuiteLocationButton = new Button(testGroup, SWT.PUSH); |
| 142 |
testSuiteLocationButton.setText("Browse..."); |
114 |
testSuiteLocationButton.setText("Browse..."); |
|
Lines 180-187
Link Here
|
| 180 |
} |
152 |
} |
| 181 |
}); |
153 |
}); |
| 182 |
|
154 |
|
| 183 |
init(); |
|
|
| 184 |
|
| 185 |
layout(false,true); |
155 |
layout(false,true); |
| 186 |
} |
156 |
} |
| 187 |
} |
157 |
} |