1 | /** |
2 | * |
3 | */ |
4 | package de.uka.ipd.sdq.dsexplore.launch; |
5 | |
6 | import java.util.HashMap; |
7 | import java.util.LinkedList; |
8 | import java.util.List; |
9 | import java.util.Map; |
10 | |
11 | import org.eclipse.core.runtime.CoreException; |
12 | import org.eclipse.debug.core.ILaunchConfiguration; |
13 | import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
14 | import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; |
15 | import org.eclipse.swt.SWT; |
16 | import org.eclipse.swt.custom.StackLayout; |
17 | import org.eclipse.swt.events.ModifyEvent; |
18 | import org.eclipse.swt.events.ModifyListener; |
19 | import org.eclipse.swt.events.SelectionAdapter; |
20 | import org.eclipse.swt.events.SelectionEvent; |
21 | import org.eclipse.swt.events.SelectionListener; |
22 | import org.eclipse.swt.graphics.Image; |
23 | import org.eclipse.swt.layout.FormAttachment; |
24 | import org.eclipse.swt.layout.FormData; |
25 | import org.eclipse.swt.layout.FormLayout; |
26 | import org.eclipse.swt.layout.GridData; |
27 | import org.eclipse.swt.layout.GridLayout; |
28 | import org.eclipse.swt.widgets.Button; |
29 | import org.eclipse.swt.widgets.Combo; |
30 | import org.eclipse.swt.widgets.Composite; |
31 | import org.eclipse.swt.widgets.FileDialog; |
32 | import org.eclipse.swt.widgets.Group; |
33 | import org.eclipse.swt.widgets.Label; |
34 | import org.eclipse.swt.widgets.Shell; |
35 | import org.eclipse.swt.widgets.Spinner; |
36 | import org.eclipse.swt.widgets.Table; |
37 | import org.eclipse.swt.widgets.TableColumn; |
38 | import org.eclipse.swt.widgets.TableItem; |
39 | import org.eclipse.swt.widgets.Text; |
40 | |
41 | import de.uka.ipd.sdq.dsexplore.DSEPluginActivator; |
42 | import de.uka.ipd.sdq.dsexplore.qml.pcm.datastructures.EvaluationAspectWithContext; |
43 | import de.uka.ipd.sdq.tcfmoop.config.TerminationCriteriaNames; |
44 | import de.uka.ipd.sdq.workflow.launchconfig.RunConfigPlugin; |
45 | |
46 | /** |
47 | * @author Atanas Dimitrov |
48 | * |
49 | */ |
50 | public class TerminationCriteriaTab extends AbstractLaunchConfigurationTab { |
51 | |
52 | private final static String TAB_NAME = "Termination Criteria"; |
53 | private final static String MENU_COMMON_SETTING = "Termination Criteria Manager"; |
54 | private final static String MENU_MAX_GEN_NUM = "Maximum Number Of Generations"; |
55 | private final static String MENU_ELAPSED_TIME = "Elapsed Time"; |
56 | private final static String MENU_NO_NEW_PARETO_OPTIMAL_CANDIDATES_FOUND = "No New Pareto Optimal Candidates Found"; |
57 | private final static String MENU_PARETO_OPTIMAL_SET_STABILITY = "Pareto Optimal Set Stability"; |
58 | private final static String MENU_MINIMAL_QUALITY_CRITERIA_VALUE = "Minimal Quality Criteria Value"; |
59 | private final static String MENU_A_GIVEN_PARETO_FRONT_IS_REACHED = "A Given Pareto Front Is Reached"; |
60 | private final static String MENU_INSIGNIFICANT_SET_QUALITY_IMPROVEMENT = "Insignificant Set Quality Improvement"; |
61 | private final static String MENU_INSIGNIFICANT_PARETO_FRONT_CHANGE = "Insignificant Pareto Front Change"; |
62 | |
63 | private Image icon; |
64 | |
65 | private StackLayout stackLayout = new StackLayout(); |
66 | private GridLayout oneBlocksGrid = new GridLayout(); |
67 | private GridLayout twoBlocksGrid = new GridLayout(); |
68 | private GridLayout threeBlocksGrid = new GridLayout(); |
69 | private GridLayout fiveBlocksGrid = new GridLayout(); |
70 | |
71 | private Map<String, Composite> contentMap = new HashMap<String, Composite>(); |
72 | |
73 | private Composite container; |
74 | private Composite headerContainer; |
75 | private Composite bodyContainer; |
76 | |
77 | private Composite commonComposite; |
78 | private Composite maxGenNumComposite; |
79 | private Composite elapsedTimeComposite; |
80 | private Composite noNewParetoOptimalCandidatesFoundComposite; |
81 | private Composite paretoOptimalSetStabilityComposite; |
82 | private Composite minimalQualityCriteriaValueComposite; |
83 | private Composite aGivenParetoFrontIsReachedComposite; |
84 | private Composite insignificantSetQualityImprovementComposite; |
85 | private Composite insignificantParetoFrontChangeComposite; |
86 | |
87 | private Combo itemsToConfig; |
88 | |
89 | // Common Begin |
90 | private Button useTerminationCriteria; |
91 | private Button runInComparisionMode; |
92 | // Common End |
93 | |
94 | // ComposedMode Begin |
95 | private Button activateComposedCriteria; |
96 | private Button expAnd; |
97 | private Button expOr; |
98 | private Button expNot; |
99 | private Button expBrackets; |
100 | private Button expCrit; |
101 | private Button expValidate; |
102 | private Text composedExpression; |
103 | private Label expressionIsValid; |
104 | // ComposedMode End |
105 | |
106 | // Maximum Generation Number Begin |
107 | private Button maxGenNumActivate; |
108 | private Label maxGenNumLabel; |
109 | private Spinner maxGenNumSpinner; |
110 | // Maximum Generation Number End |
111 | |
112 | // Maximum Generation Number Begin |
113 | private Button elapsedTimeActivate; |
114 | private Label elapsedTimeLabel; |
115 | private Label elapsedTimeLabel2; |
116 | private Spinner elapsedTimeSpinner; |
117 | private Combo elapsedTimeCombo; |
118 | // Maximum Generation Number End |
119 | |
120 | // No New Pareto Optimal Candidates Found Begin |
121 | private Button noNewParetoOptimalCandidatesFoundActivate; |
122 | private Label noNewParetoOptimalCandidatesFoundLabel; |
123 | private Spinner noNewParetoOptimalCandidatesFoundSpinner; |
124 | // No New Pareto Optimal Candidates Found End |
125 | |
126 | // Pareto Optimal Set Stability Begin |
127 | private Button paretoOptimalSetStabilityActivate; |
128 | private Label paretoOptimalSetStabilityLabel; |
129 | private Combo paretoOptimalSetStabilityCombo; |
130 | private Label paretoOptimalSetStabilityLabel1; |
131 | private Spinner paretoOptimalSetStabilitySpinner; |
132 | private Label paretoOptimalSetStabilityLabel2; |
133 | private Spinner paretoOptimalSetStabilitySpinner1; |
134 | private Label paretoOptimalSetStabilityLabel3; |
135 | private Spinner paretoOptimalSetStabilitySpinner2; |
136 | // Pareto Optimal Set Stability End |
137 | |
138 | // A Given Pareto Front Is Reached Begin |
139 | private Button aGivenParetoFrontIsReachedActivate; |
140 | private Label aGivenParetoFrontIsReachedLabel; |
141 | private Spinner aGivenParetoFrontIsReachedSpinner; |
142 | private Label aGivenParetoFrontIsReachedLabel1; |
143 | private Text aGivenParetoFrontIsReachedText; |
144 | private Button aGivenParetoFrontIsReachedBrowse; |
145 | private FileDialog aGivenParetoFrontIsReachedFileDialog; |
146 | // A Given Pareto Front Is Reached End |
147 | |
148 | // Insignificant Pareto Front Change Begin |
149 | private Button insignificantParetoFrontChangeActivate; |
150 | private Label insignificantParetoFrontChangeLabel; |
151 | private Spinner insignificantParetoFrontChangeSpinner; |
152 | private Label insignificantParetoFrontChangeLabel1; |
153 | private Label insignificantParetoFrontChangeLabel2; |
154 | private Spinner insignificantParetoFrontChangeSpinner1; |
155 | // Insignificant Pareto Front Change End |
156 | |
157 | // Minimal Quality Criteria Value Begin |
158 | private Button minimalQualityCriteriaValueActivate; |
159 | private Label minimalQualityCriteriaValueLabel; |
160 | private Spinner minimalQualityCriteriaValueSpinner; |
161 | private Label minimalQualityCriteriaValueLabel1; |
162 | private Table minimalQualityCriteriaValueTable; |
163 | private Button minimalQualityCriteriaValueButton; |
164 | private Button minimalQualityCriteriaValueButton1; |
165 | private Button minimalQualityCriteriaValueButton2; |
166 | // Minimal Quality Criteria Value End |
167 | |
168 | // Insignificant Set Quality Improvement Begin |
169 | private Button insignificantSetQualityImprovementActivate; |
170 | private Label insignificantSetQualityImprovementLabel; |
171 | private Spinner insignificantSetQualityImprovementSpinner; |
172 | private Label insignificantSetQualityImprovementLabel1; |
173 | private Label insignificantSetQualityImprovementLabel2; |
174 | private Table insignificantSetQualityImprovementTable; |
175 | private Button insignificantSetQualityImprovementButton; |
176 | private Button insignificantSetQualityImprovementButton1; |
177 | private Button insignificantSetQualityImprovementButton2; |
178 | // Insignificant Set Quality Improvement End |
179 | |
180 | private QMLManager qmlManager; |
181 | |
182 | public TerminationCriteriaTab(QMLManager qmlManager) { |
183 | this.qmlManager = qmlManager; |
184 | } |
185 | |
186 | @Override |
187 | public Image getImage() { |
188 | if (icon == null) { |
189 | icon = DSEPluginActivator.getImageDescriptor("icons/tcmanager.gif") |
190 | .createImage(); |
191 | } |
192 | return icon; |
193 | } |
194 | |
195 | final ModifyListener modifyListener = new ModifyListener() { |
196 | |
197 | public void modifyText(ModifyEvent e) { |
198 | TerminationCriteriaTab.this.setDirty(true); |
199 | TerminationCriteriaTab.this.updateLaunchConfigurationDialog(); |
200 | } |
201 | }; |
202 | |
203 | final SelectionListener selectionListener = new SelectionListener() { |
204 | |
205 | public void widgetDefaultSelected(SelectionEvent e) { |
206 | TerminationCriteriaTab.this.setDirty(true); |
207 | TerminationCriteriaTab.this.updateLaunchConfigurationDialog(); |
208 | } |
209 | |
210 | public void widgetSelected(SelectionEvent e) { |
211 | TerminationCriteriaTab.this.setDirty(true); |
212 | TerminationCriteriaTab.this.updateLaunchConfigurationDialog(); |
213 | } |
214 | }; |
215 | |
216 | @Override |
217 | public void createControl(Composite parent) { |
218 | this.oneBlocksGrid.numColumns = 1; |
219 | this.twoBlocksGrid.numColumns = 2; |
220 | this.threeBlocksGrid.numColumns = 3; |
221 | this.fiveBlocksGrid.numColumns = 5; |
222 | |
223 | container = new Composite(parent, SWT.NONE); |
224 | this.setControl(container); |
225 | container.setLayout(oneBlocksGrid); |
226 | container.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true)); |
227 | |
228 | this.headerContainer = new Composite(container, SWT.NONE); |
229 | this.headerContainer.setLayout(oneBlocksGrid); |
230 | this.headerContainer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, |
231 | true, false)); |
232 | |
233 | this.bodyContainer = new Composite(container, SWT.NONE); |
234 | this.bodyContainer.setLayout(this.stackLayout); |
235 | this.bodyContainer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, |
236 | true)); |
237 | |
238 | this.initAndAddCommonCompositeContent(); |
239 | this.initAndAddMaxGenNumCompositeContent(); |
240 | this.initAndAddElapsedTimeComposedContent(); |
241 | this.initAndAddNoNewParetoOptimalCandidatesFoundComposedContent(); |
242 | this.initAndAddParetoOptimalSetStabilityComposedContent(); |
243 | this.initAndAddAGivenParetoFrontIsReachedComposedContent(); |
244 | this.initAndAddInsignificantParetoFrontChangeContent(); |
245 | this.initAndAddMinimalQualityCriteriaValueContent(); |
246 | this.initAndAddInsignificantSetQualityImprovementContent(); |
247 | |
248 | this.menuSelector(); |
249 | |
250 | this.stackLayout.topControl = this.commonComposite; |
251 | } |
252 | |
253 | private void menuSelector() { |
254 | itemsToConfig = new Combo(this.headerContainer, SWT.READ_ONLY); |
255 | itemsToConfig.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
256 | itemsToConfig.setEnabled(true); |
257 | |
258 | String[] items = this.contentMap.keySet().toArray(new String[1]); |
259 | |
260 | itemsToConfig.setItems(items); |
261 | itemsToConfig.addModifyListener(modifyListener); |
262 | itemsToConfig.addSelectionListener(selectionListener); |
263 | |
264 | itemsToConfig.addSelectionListener(new SelectionAdapter() { |
265 | @Override |
266 | public void widgetSelected(SelectionEvent e) { |
267 | // enable level and half-with fields if and only if check |
268 | // box is checked |
269 | stackLayout.topControl = contentMap.get(itemsToConfig |
270 | .getItem(itemsToConfig.getSelectionIndex())); |
271 | TerminationCriteriaTab.this.updateLaunchConfigurationDialog(); |
272 | } |
273 | }); |
274 | |
275 | itemsToConfig.select(0); |
276 | } |
277 | |
278 | private void initAndAddCommonCompositeContent() { |
279 | commonComposite = new Composite(bodyContainer, SWT.NONE); |
280 | commonComposite.setLayout(new GridLayout()); |
281 | |
282 | Group commonSettingsGroup = new Group(commonComposite, SWT.NONE); |
283 | commonSettingsGroup.setLayout(twoBlocksGrid); |
284 | commonSettingsGroup.setText("Common Settings"); |
285 | commonSettingsGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, |
286 | false)); |
287 | |
288 | useTerminationCriteria = createButton(commonSettingsGroup, |
289 | "Use termination Criteria", true, SWT.CHECK, null, null); |
290 | |
291 | runInComparisionMode = createButton(commonSettingsGroup, |
292 | "Run in Comparision Mode", true, SWT.CHECK, null, null); |
293 | |
294 | Group composedCriteriaGroup = new Group(commonComposite, SWT.NONE); |
295 | composedCriteriaGroup.setLayout(twoBlocksGrid); |
296 | composedCriteriaGroup.setText("Composed Termination Criterion"); |
297 | composedCriteriaGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, |
298 | true, false)); |
299 | |
300 | Group composedExpressionGroup = new Group(commonComposite, SWT.NONE); |
301 | |
302 | activateComposedCriteria = createButton(composedCriteriaGroup, |
303 | "Activate Composed Termination Criterion", true, SWT.CHECK, |
304 | null, new SelectionAdapter() { |
305 | @Override |
306 | public void widgetSelected(SelectionEvent e) { |
307 | // enable level and half-with fields if and only if |
308 | // check |
309 | // box is checked |
310 | boolean selected = activateComposedCriteria |
311 | .getSelection(); |
312 | expAnd.setEnabled(selected); |
313 | expOr.setEnabled(selected); |
314 | expNot.setEnabled(selected); |
315 | expBrackets.setEnabled(selected); |
316 | expCrit.setEnabled(selected); |
317 | composedExpression.setEnabled(selected); |
318 | expValidate.setEnabled(selected); |
319 | expressionIsValid.setEnabled(selected); |
320 | TerminationCriteriaTab.this |
321 | .updateLaunchConfigurationDialog(); |
322 | } |
323 | |
324 | }); |
325 | |
326 | composedExpressionGroup.setLayout(this.oneBlocksGrid); |
327 | composedExpressionGroup |
328 | .setText("Composed Termination Criterion Expression"); |
329 | composedExpressionGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, |
330 | true, false)); |
331 | composedExpressionGroup.setEnabled(true); |
332 | |
333 | Group composedExpressionGroupInternal1 = new Group( |
334 | composedExpressionGroup, SWT.None | SWT.SHADOW_NONE); |
335 | composedExpressionGroupInternal1.setLayout(this.fiveBlocksGrid); |
336 | composedExpressionGroupInternal1.setLayoutData(new GridData(SWT.FILL, |
337 | SWT.TOP, true, false)); |
338 | composedExpressionGroupInternal1.setEnabled(true); |
339 | |
340 | expAnd = this.createButton(composedExpressionGroupInternal1, " && ", |
341 | composedExpressionGroupInternal1.isEnabled(), SWT.PUSH, null, |
342 | new SelectionAdapter() { |
343 | @Override |
344 | public void widgetSelected(SelectionEvent e) { |
345 | StringBuilder currentExpression = new StringBuilder( |
346 | composedExpression.getText()); |
347 | currentExpression.insert(composedExpression |
348 | .getCaretPosition(), " && "); |
349 | composedExpression |
350 | .setText(currentExpression.toString()); |
351 | TerminationCriteriaTab.this |
352 | .updateLaunchConfigurationDialog(); |
353 | } |
354 | }); |
355 | |
356 | expOr = this.createButton(composedExpressionGroupInternal1, " || ", |
357 | composedExpressionGroupInternal1.isEnabled(), SWT.PUSH, null, |
358 | new SelectionAdapter() { |
359 | @Override |
360 | public void widgetSelected(SelectionEvent e) { |
361 | StringBuilder currentExpression = new StringBuilder( |
362 | composedExpression.getText()); |
363 | currentExpression.insert(composedExpression |
364 | .getCaretPosition(), " || "); |
365 | composedExpression |
366 | .setText(currentExpression.toString()); |
367 | TerminationCriteriaTab.this |
368 | .updateLaunchConfigurationDialog(); |
369 | } |
370 | }); |
371 | |
372 | expNot = this.createButton(composedExpressionGroupInternal1, " ! ", |
373 | composedExpressionGroupInternal1.isEnabled(), SWT.PUSH, null, |
374 | new SelectionAdapter() { |
375 | @Override |
376 | public void widgetSelected(SelectionEvent e) { |
377 | StringBuilder currentExpression = new StringBuilder( |
378 | composedExpression.getText()); |
379 | currentExpression.insert(composedExpression |
380 | .getCaretPosition(), " !"); |
381 | composedExpression |
382 | .setText(currentExpression.toString()); |
383 | TerminationCriteriaTab.this |
384 | .updateLaunchConfigurationDialog(); |
385 | } |
386 | }); |
387 | |
388 | expBrackets = this.createButton(composedExpressionGroupInternal1, |
389 | " ( .. ) ", composedExpressionGroupInternal1.isEnabled(), |
390 | SWT.PUSH, null, new SelectionAdapter() { |
391 | @Override |
392 | public void widgetSelected(SelectionEvent e) { |
393 | StringBuilder currentExpression = new StringBuilder( |
394 | composedExpression.getText()); |
395 | currentExpression.insert(composedExpression |
396 | .getSelection().y, " ) "); |
397 | currentExpression.insert(composedExpression |
398 | .getSelection().x, " ( "); |
399 | |
400 | composedExpression |
401 | .setText(currentExpression.toString()); |
402 | TerminationCriteriaTab.this |
403 | .updateLaunchConfigurationDialog(); |
404 | } |
405 | }); |
406 | |
407 | expCrit = this.createButton(composedExpressionGroupInternal1, |
408 | " Criterion ", composedExpressionGroupInternal1.isEnabled(), |
409 | SWT.PUSH, null, new SelectionAdapter() { |
410 | @Override |
411 | public void widgetSelected(SelectionEvent e) { |
412 | final Shell dialog = new Shell( |
413 | minimalQualityCriteriaValueButton.getShell(), |
414 | SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); |
415 | dialog.setText("Select a configured Criterion:"); |
416 | FormLayout formLayout = new FormLayout(); |
417 | formLayout.marginWidth = 10; |
418 | formLayout.marginHeight = 10; |
419 | formLayout.spacing = 10; |
420 | dialog.setLayout(formLayout); |
421 | |
422 | FormData data = new FormData(); |
423 | Label label = createLabel(dialog, |
424 | "Select Termination Criterion: ", true, |
425 | SWT.NONE, data); |
426 | |
427 | final Combo configuredCriteriaCombo = new Combo(dialog, |
428 | SWT.READ_ONLY); |
429 | configuredCriteriaCombo.setEnabled(true); |
430 | List<String> items = new LinkedList<String>(); |
431 | |
432 | if (maxGenNumActivate.getSelection()) { |
433 | items |
434 | .add(TerminationCriteriaNames.MAXIMUM_NUMBER_OF_GENERATIONS |
435 | .name()); |
436 | } |
437 | |
438 | if (elapsedTimeActivate.getSelection()) { |
439 | items.add(TerminationCriteriaNames.ELAPSED_TIME |
440 | .name()); |
441 | } |
442 | |
443 | if (noNewParetoOptimalCandidatesFoundActivate |
444 | .getSelection()) { |
445 | items |
446 | .add(TerminationCriteriaNames.NO_NEW_PARETO_OPTIMAL_CANDIDATES_FOUND |
447 | .name()); |
448 | } |
449 | |
450 | if (paretoOptimalSetStabilityActivate.getSelection()) { |
451 | items |
452 | .add(TerminationCriteriaNames.PARETO_OPTIMAL_SET_STABILITY |
453 | .name()); |
454 | } |
455 | |
456 | if (aGivenParetoFrontIsReachedActivate.getSelection()) { |
457 | items |
458 | .add(TerminationCriteriaNames.GIVEN_PARETO_FRONT_IS_REACHED |
459 | .name()); |
460 | } |
461 | |
462 | if (insignificantParetoFrontChangeActivate |
463 | .getSelection()) { |
464 | items |
465 | .add(TerminationCriteriaNames.INSIGNIFICANT_PARETO_FRONT_CHANGE |
466 | .name()); |
467 | } |
468 | |
469 | if (minimalQualityCriteriaValueActivate.getSelection()) { |
470 | items |
471 | .add(TerminationCriteriaNames.MINIMAL_QUALITY_CIRTERIA_VALUE |
472 | .name()); |
473 | } |
474 | |
475 | if (insignificantSetQualityImprovementActivate |
476 | .getSelection()) { |
477 | items |
478 | .add(TerminationCriteriaNames.INSIGNIFICANT_SET_QUALITY_IMPROVEMENT |
479 | .name()); |
480 | } |
481 | |
482 | configuredCriteriaCombo.setItems(items |
483 | .toArray(new String[0])); |
484 | configuredCriteriaCombo.select(0); |
485 | data = new FormData(); |
486 | data.top = new FormAttachment(label, 0, SWT.DEFAULT); |
487 | configuredCriteriaCombo.setLayoutData(data); |
488 | |
489 | data = new FormData(); |
490 | data.width = 60; |
491 | data.left = new FormAttachment(configuredCriteriaCombo, |
492 | 0, SWT.DEFAULT); |
493 | data.bottom = new FormAttachment(100, 0); |
494 | Button ok = createButton(dialog, "OK", true, SWT.PUSH, |
495 | data, new SelectionAdapter() { |
496 | @Override |
497 | public void widgetSelected(SelectionEvent e) { |
498 | StringBuilder currentExpression = new StringBuilder( |
499 | composedExpression.getText()); |
500 | currentExpression |
501 | .insert( |
502 | composedExpression |
503 | .getCaretPosition(), |
504 | " " |
505 | + configuredCriteriaCombo |
506 | .getItem(configuredCriteriaCombo |
507 | .getSelectionIndex()) |
508 | + " "); |
509 | composedExpression |
510 | .setText(currentExpression |
511 | .toString()); |
512 | TerminationCriteriaTab.this |
513 | .updateLaunchConfigurationDialog(); |
514 | dialog.close(); |
515 | } |
516 | }); |
517 | |
518 | data = new FormData(); |
519 | data.width = 60; |
520 | data.left = new FormAttachment(ok, 0, SWT.DEFAULT); |
521 | data.bottom = new FormAttachment(100, 0); |
522 | createButton(dialog, "Cancel", true, SWT.PUSH, data, |
523 | new SelectionAdapter() { |
524 | @Override |
525 | public void widgetSelected(SelectionEvent e) { |
526 | dialog.close(); |
527 | } |
528 | }); |
529 | |
530 | dialog.setDefaultButton(ok); |
531 | dialog.pack(); |
532 | dialog.open(); |
533 | } |
534 | }); |
535 | |
536 | Group composedExpressionGroupInternal2 = new Group( |
537 | composedExpressionGroup, SWT.None | SWT.SHADOW_NONE); |
538 | composedExpressionGroupInternal2.setLayout(this.twoBlocksGrid); |
539 | composedExpressionGroupInternal2.setLayoutData(new GridData(SWT.FILL, |
540 | SWT.TOP, true, false)); |
541 | composedExpressionGroupInternal2.setEnabled(true); |
542 | |
543 | composedExpression = new Text(composedExpressionGroupInternal2, |
544 | SWT.SINGLE | SWT.WRAP | SWT.BORDER); |
545 | composedExpression |
546 | .setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
547 | composedExpression.setEnabled(composedExpression.getParent() |
548 | .isEnabled()); |
549 | composedExpression.addModifyListener(modifyListener); |
550 | |
551 | expValidate = this.createButton(composedExpressionGroupInternal2, |
552 | " Normalize And Validate ", composedExpressionGroupInternal2 |
553 | .isEnabled(), SWT.PUSH, null, new SelectionAdapter() { |
554 | @Override |
555 | /** |
556 | * Performs several tests to check the consistency of the boolean expression. |
557 | * Tests include: Correct usage of &&, || and correct number of brackets. |
558 | * Check whether all used termination criteria can be located and are active. |
559 | */ |
560 | public void widgetSelected(SelectionEvent e) { |
561 | |
562 | int expressionSize = composedExpression.getText() |
563 | .length(); |
564 | |
565 | String currentExp = composedExpression.getText() |
566 | .replaceAll("\\s\\s", " "); |
567 | |
568 | while (currentExp.contains(" ")) { |
569 | currentExp = currentExp.replaceAll("\\s\\s", " "); |
570 | } |
571 | |
572 | composedExpression.setText(currentExp); |
573 | |
574 | currentExp = currentExp.replaceAll("&&", ""); |
575 | if (currentExp.contains("&")) { |
576 | expressionIsValid |
577 | .setText("Expression is not valid. The ''&&'' is misused. Click Normalize and Validate to refresh."); |
578 | TerminationCriteriaTab.this |
579 | .updateLaunchConfigurationDialog(); |
580 | return; |
581 | } |
582 | |
583 | currentExp = currentExp.replaceAll("\\|\\|", ""); |
584 | if (currentExp.contains("|")) { |
585 | expressionIsValid |
586 | .setText("Expression is not valid. The ''||'' is misused. Click Normalize and Validate to refresh."); |
587 | TerminationCriteriaTab.this |
588 | .updateLaunchConfigurationDialog(); |
589 | return; |
590 | } |
591 | |
592 | if ((currentExp.length() - currentExp.replaceAll("\\(", |
593 | "").length()) != (currentExp.length() - currentExp |
594 | .replaceAll("\\)", "").length())) { |
595 | expressionIsValid |
596 | .setText("Expression is not valid. The number of opening and closing brackets do not match. Click Normalize and Validate to refresh."); |
597 | TerminationCriteriaTab.this |
598 | .updateLaunchConfigurationDialog(); |
599 | return; |
600 | } else { |
601 | currentExp = currentExp.replaceAll("\\(", ""); |
602 | currentExp = currentExp.replaceAll("\\)", ""); |
603 | } |
604 | |
605 | currentExp = currentExp.replaceAll("\\s\\s", " "); |
606 | |
607 | String[] usedTCUnTrimmed = currentExp.split(" "); |
608 | |
609 | List<String> usedTCList = new LinkedList<String>(); |
610 | |
611 | for (int i = 0; i < usedTCUnTrimmed.length; i++) { |
612 | String entry = usedTCUnTrimmed[i].trim(); |
613 | |
614 | if (!entry.isEmpty()) { |
615 | usedTCList.add(entry); |
616 | } |
617 | } |
618 | |
619 | String[] usedTC = usedTCList.toArray(new String[0]); |
620 | |
621 | if (expressionSize != 0 && usedTC.length == 0) { |
622 | expressionIsValid |
623 | .setText("Expression is not valid. At least one termination criterion must be selected. Click Normalize and Validate to refresh."); |
624 | TerminationCriteriaTab.this |
625 | .updateLaunchConfigurationDialog(); |
626 | return; |
627 | } |
628 | |
629 | for (String crit : usedTC) { |
630 | |
631 | if (crit |
632 | .equalsIgnoreCase(TerminationCriteriaNames.MAXIMUM_NUMBER_OF_GENERATIONS |
633 | .name())) { |
634 | if (!maxGenNumActivate.getSelection()) { |
635 | expressionIsValid |
636 | .setText("Expression is not valid. MAXIMUM_NUMBER_OF_GENERATIONS is not activated. Click Normalize and Validate to refresh."); |
637 | TerminationCriteriaTab.this |
638 | .updateLaunchConfigurationDialog(); |
639 | return; |
640 | } |
641 | continue; |
642 | } |
643 | |
644 | if (crit |
645 | .equalsIgnoreCase(TerminationCriteriaNames.ELAPSED_TIME |
646 | .name())) { |
647 | if (!elapsedTimeActivate.getSelection()) { |
648 | expressionIsValid |
649 | .setText("Expression is not valid. ELAPSED_TIME is not activated. Click Normalize and Validate to refresh."); |
650 | TerminationCriteriaTab.this |
651 | .updateLaunchConfigurationDialog(); |
652 | return; |
653 | } |
654 | continue; |
655 | } |
656 | |
657 | if (crit |
658 | .equalsIgnoreCase(TerminationCriteriaNames.NO_NEW_PARETO_OPTIMAL_CANDIDATES_FOUND |
659 | .name())) { |
660 | if (!noNewParetoOptimalCandidatesFoundActivate |
661 | .getSelection()) { |
662 | expressionIsValid |
663 | .setText("Expression is not valid. NO_NEW_PARETO_OPTIMAL_CANDIDATES_FOUND is not activated. Click Normalize and Validate to refresh."); |
664 | TerminationCriteriaTab.this |
665 | .updateLaunchConfigurationDialog(); |
666 | return; |
667 | } |
668 | continue; |
669 | } |
670 | |
671 | if (crit |
672 | .equalsIgnoreCase(TerminationCriteriaNames.PARETO_OPTIMAL_SET_STABILITY |
673 | .name())) { |
674 | if (!paretoOptimalSetStabilityActivate |
675 | .getSelection()) { |
676 | expressionIsValid |
677 | .setText("Expression is not valid. PARETO_OPTIMAL_SET_STABILITY is not activated. Click Normalize and Validate to refresh."); |
678 | TerminationCriteriaTab.this |
679 | .updateLaunchConfigurationDialog(); |
680 | return; |
681 | } |
682 | continue; |
683 | } |
684 | |
685 | if (crit |
686 | .equalsIgnoreCase(TerminationCriteriaNames.GIVEN_PARETO_FRONT_IS_REACHED |
687 | .name())) { |
688 | if (!aGivenParetoFrontIsReachedActivate |
689 | .getSelection()) { |
690 | expressionIsValid |
691 | .setText("Expression is not valid. GIVEN_PARETO_FRONT_IS_REACHED is not activated. Click Normalize and Validate to refresh."); |
692 | TerminationCriteriaTab.this |
693 | .updateLaunchConfigurationDialog(); |
694 | return; |
695 | } |
696 | continue; |
697 | } |
698 | |
699 | if (crit |
700 | .equalsIgnoreCase(TerminationCriteriaNames.INSIGNIFICANT_PARETO_FRONT_CHANGE |
701 | .name())) { |
702 | if (!insignificantParetoFrontChangeActivate |
703 | .getSelection()) { |
704 | expressionIsValid |
705 | .setText("Expression is not valid. INSIGNIFICANT_PARETO_FRONT_CHANGE is not activated. Click Normalize and Validate to refresh."); |
706 | TerminationCriteriaTab.this |
707 | .updateLaunchConfigurationDialog(); |
708 | return; |
709 | } |
710 | continue; |
711 | } |
712 | |
713 | if (crit |
714 | .equalsIgnoreCase(TerminationCriteriaNames.MINIMAL_QUALITY_CIRTERIA_VALUE |
715 | .name())) { |
716 | if (!minimalQualityCriteriaValueActivate |
717 | .getSelection()) { |
718 | expressionIsValid |
719 | .setText("Expression is not valid. MINIMAL_QUALITY_CIRTERIA_VALUE is not activated. Click Normalize and Validate to refresh."); |
720 | TerminationCriteriaTab.this |
721 | .updateLaunchConfigurationDialog(); |
722 | return; |
723 | } |
724 | continue; |
725 | } |
726 | |
727 | if (crit |
728 | .equalsIgnoreCase(TerminationCriteriaNames.INSIGNIFICANT_SET_QUALITY_IMPROVEMENT |
729 | .name())) { |
730 | if (!insignificantSetQualityImprovementActivate |
731 | .getSelection()) { |
732 | expressionIsValid |
733 | .setText("Expression is not valid. INSIGNIFICANT_SET_QUALITY_IMPROVEMENT is not activated. Click Normalize and Validate to refresh."); |
734 | TerminationCriteriaTab.this |
735 | .updateLaunchConfigurationDialog(); |
736 | return; |
737 | } |
738 | continue; |
739 | } |
740 | |
741 | expressionIsValid |
742 | .setText("Expression is not valid. " |
743 | + crit |
744 | + " cannot be recognised as a Termination Criterion. Click Normalize and Validate to refresh."); |
745 | TerminationCriteriaTab.this |
746 | .updateLaunchConfigurationDialog(); |
747 | return; |
748 | |
749 | } |
750 | |
751 | expressionIsValid |
752 | .setText("Expression seems to be valid. Note that this check does not guarantee the correctnes of the expression. Click Normalize and Validate to refresh."); |
753 | TerminationCriteriaTab.this |
754 | .updateLaunchConfigurationDialog(); |
755 | } |
756 | }); |
757 | |
758 | this.expressionIsValid = this |
759 | .createLabel( |
760 | composedExpressionGroup, |
761 | "Expression seems to be valid. Click Normalize and Validate to refresh.", |
762 | composedExpressionGroup.isEnabled(), SWT.HORIZONTAL |
763 | | SWT.LEFT, null); |
764 | |
765 | this.contentMap.put(MENU_COMMON_SETTING, commonComposite); |
766 | } |
767 | |
768 | /** |
769 | * Creates a Button |
770 | * |
771 | * @param parent |
772 | * @param text |
773 | * @param isEnabled |
774 | * @param type |
775 | * @param data |
776 | * will not be used if null |
777 | * @param selectionAdapter |
778 | * will not be used if null |
779 | * @return a new Button |
780 | */ |
781 | private Button createButton(Composite parent, String text, |
782 | boolean isEnabled, int type, FormData data, |
783 | SelectionAdapter selectionAdapter) { |
784 | Button button = new Button(parent, type); |
785 | button.setEnabled(isEnabled); |
786 | button.setText(text); |
787 | if (data != null) { |
788 | button.setLayoutData(data); |
789 | } |
790 | button.addSelectionListener(selectionListener); |
791 | if (selectionAdapter != null) { |
792 | button.addSelectionListener(selectionAdapter); |
793 | } |
794 | return button; |
795 | } |
796 | |
797 | /** |
798 | * Creates a Label |
799 | * |
800 | * @param parent |
801 | * @param text |
802 | * @param isEnabled |
803 | * @param style |
804 | * @param data |
805 | * will not be used if null |
806 | * @return |
807 | */ |
808 | private Label createLabel(Composite parent, String text, boolean isEnabled, |
809 | int style, FormData data) { |
810 | Label label = new Label(parent, style); |
811 | label.setText(text); |
812 | if (data != null) { |
813 | label.setLayoutData(data); |
814 | } |
815 | label.setEnabled(isEnabled); |
816 | return label; |
817 | } |
818 | |
819 | private void initAndAddMaxGenNumCompositeContent() { |
820 | maxGenNumComposite = new Composite(this.bodyContainer, SWT.TOP); |
821 | maxGenNumComposite.setLayout(new GridLayout()); |
822 | |
823 | this.maxGenNumActivate = this.createButton(this.maxGenNumComposite, |
824 | "Activate this criterion", true, SWT.CHECK, null, |
825 | new SelectionAdapter() { |
826 | @Override |
827 | public void widgetSelected(SelectionEvent e) { |
828 | // enable level and half-with fields if and only if |
829 | // check |
830 | // box is checked |
831 | boolean selected = maxGenNumActivate.getSelection(); |
832 | maxGenNumLabel.setEnabled(selected); |
833 | maxGenNumSpinner.setEnabled(selected); |
834 | TerminationCriteriaTab.this |
835 | .updateLaunchConfigurationDialog(); |
836 | } |
837 | |
838 | }); |
839 | |
840 | Group maxGenNumSettings = new Group(this.maxGenNumComposite, SWT.NONE); |
841 | maxGenNumSettings.setLayout(this.twoBlocksGrid); |
842 | maxGenNumSettings.setText("Configuration"); |
843 | maxGenNumSettings.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, |
844 | false)); |
845 | maxGenNumSettings.setEnabled(true); |
846 | |
847 | this.maxGenNumLabel = this.createLabel(maxGenNumSettings, |
848 | "Maximum number of Generations: ", false, SWT.HORIZONTAL |
849 | | SWT.LEFT, null); |
850 | |
851 | this.maxGenNumSpinner = new Spinner(maxGenNumSettings, SWT.NONE); |
852 | this.maxGenNumSpinner.setValues(1, 1, Integer.MAX_VALUE, 0, 1, 1); |
853 | this.maxGenNumSpinner.setEnabled(false); |
854 | |
855 | this.contentMap.put(MENU_MAX_GEN_NUM, maxGenNumComposite); |
856 | |
857 | } |
858 | |
859 | private void initAndAddElapsedTimeComposedContent() { |
860 | elapsedTimeComposite = new Composite(this.bodyContainer, SWT.TOP); |
861 | elapsedTimeComposite.setLayout(new GridLayout()); |
862 | |
863 | this.elapsedTimeActivate = this.createButton(this.elapsedTimeComposite, |
864 | "Activate this criterion", true, SWT.CHECK, null, |
865 | new SelectionAdapter() { |
866 | @Override |
867 | public void widgetSelected(SelectionEvent e) { |
868 | // enable level and half-with fields if and only if |
869 | // check |
870 | // box is checked |
871 | boolean selected = elapsedTimeActivate.getSelection(); |
872 | elapsedTimeLabel.setEnabled(selected); |
873 | elapsedTimeLabel2.setEnabled(selected); |
874 | elapsedTimeSpinner.setEnabled(selected); |
875 | elapsedTimeCombo.setEnabled(selected); |
876 | TerminationCriteriaTab.this |
877 | .updateLaunchConfigurationDialog(); |
878 | } |
879 | |
880 | }); |
881 | |
882 | Group elapsedTimeSettings = new Group(this.elapsedTimeComposite, |
883 | SWT.NONE); |
884 | elapsedTimeSettings.setLayout(this.twoBlocksGrid); |
885 | elapsedTimeSettings.setText("Configuration"); |
886 | elapsedTimeSettings.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, |
887 | false)); |
888 | elapsedTimeSettings.setEnabled(true); |
889 | |
890 | this.elapsedTimeLabel = this.createLabel(elapsedTimeSettings, |
891 | "Type of the measured time: ", false, |
892 | SWT.HORIZONTAL | SWT.LEFT, null); |
893 | |
894 | this.elapsedTimeCombo = new Combo(elapsedTimeSettings, SWT.READ_ONLY); |
895 | this.elapsedTimeCombo.setEnabled(false); |
896 | String[] items = { "USER_TIME", "CPU_TIME" }; |
897 | this.elapsedTimeCombo.setItems(items); |
898 | this.elapsedTimeCombo.select(0); |
899 | |
900 | this.elapsedTimeLabel2 = this.createLabel(elapsedTimeSettings, |
901 | "Time in minutes: ", false, SWT.HORIZONTAL | SWT.LEFT, null); |
902 | |
903 | this.elapsedTimeSpinner = new Spinner(elapsedTimeSettings, SWT.NONE); |
904 | this.elapsedTimeSpinner.setValues(1, 1, Integer.MAX_VALUE, 0, 1, 1); |
905 | this.elapsedTimeSpinner.setEnabled(false); |
906 | |
907 | this.contentMap.put(MENU_ELAPSED_TIME, elapsedTimeComposite); |
908 | |
909 | } |
910 | |
911 | private void initAndAddNoNewParetoOptimalCandidatesFoundComposedContent() { |
912 | |
913 | this.noNewParetoOptimalCandidatesFoundComposite = new Composite( |
914 | this.bodyContainer, SWT.TOP); |
915 | this.noNewParetoOptimalCandidatesFoundComposite |
916 | .setLayout(new GridLayout()); |
917 | |
918 | this.noNewParetoOptimalCandidatesFoundActivate = this.createButton( |
919 | this.noNewParetoOptimalCandidatesFoundComposite, |
920 | "Activate this criterion", true, SWT.CHECK, null, |
921 | new SelectionAdapter() { |
922 | @Override |
923 | public void widgetSelected(SelectionEvent e) { |
924 | // enable level and half-with fields if and only if |
925 | // check |
926 | // box is checked |
927 | boolean selected = noNewParetoOptimalCandidatesFoundActivate |
928 | .getSelection(); |
929 | noNewParetoOptimalCandidatesFoundLabel |
930 | .setEnabled(selected); |
931 | noNewParetoOptimalCandidatesFoundSpinner |
932 | .setEnabled(selected); |
933 | TerminationCriteriaTab.this |
934 | .updateLaunchConfigurationDialog(); |
935 | } |
936 | |
937 | }); |
938 | |
939 | Group noNewParetoOptimalCandidatesFoundSettings = new Group( |
940 | this.noNewParetoOptimalCandidatesFoundComposite, SWT.NONE); |
941 | noNewParetoOptimalCandidatesFoundSettings.setLayout(this.twoBlocksGrid); |
942 | noNewParetoOptimalCandidatesFoundSettings.setText("Configuration"); |
943 | noNewParetoOptimalCandidatesFoundSettings.setLayoutData(new GridData( |
944 | SWT.FILL, SWT.TOP, true, false)); |
945 | noNewParetoOptimalCandidatesFoundSettings.setEnabled(true); |
946 | |
947 | this.noNewParetoOptimalCandidatesFoundLabel = this |
948 | .createLabel( |
949 | noNewParetoOptimalCandidatesFoundSettings, |
950 | "Number of iterations without a new Pareto Optimal candidate: ", |
951 | false, SWT.HORIZONTAL | SWT.LEFT, null); |
952 | |
953 | this.noNewParetoOptimalCandidatesFoundSpinner = new Spinner( |
954 | noNewParetoOptimalCandidatesFoundSettings, SWT.NONE); |
955 | this.noNewParetoOptimalCandidatesFoundSpinner.setValues(1, 1, |
956 | Integer.MAX_VALUE, 0, 1, 1); |
957 | this.noNewParetoOptimalCandidatesFoundSpinner.setEnabled(false); |
958 | |
959 | this.contentMap.put(MENU_NO_NEW_PARETO_OPTIMAL_CANDIDATES_FOUND, |
960 | noNewParetoOptimalCandidatesFoundComposite); |
961 | |
962 | } |
963 | |
964 | private void initAndAddParetoOptimalSetStabilityComposedContent() { |
965 | |
966 | this.paretoOptimalSetStabilityComposite = new Composite( |
967 | this.bodyContainer, SWT.TOP); |
968 | this.paretoOptimalSetStabilityComposite.setLayout(new GridLayout()); |
969 | |
970 | this.paretoOptimalSetStabilityActivate = this.createButton( |
971 | this.paretoOptimalSetStabilityComposite, |
972 | "Activate this criterion", true, SWT.CHECK, null, |
973 | new SelectionAdapter() { |
974 | @Override |
975 | public void widgetSelected(SelectionEvent e) { |
976 | // enable level and half-with fields if and only if |
977 | // check |
978 | // box is checked |
979 | boolean selected = paretoOptimalSetStabilityActivate |
980 | .getSelection(); |
981 | paretoOptimalSetStabilityLabel.setEnabled(selected); |
982 | paretoOptimalSetStabilityCombo.setEnabled(selected); |
983 | paretoOptimalSetStabilityLabel1.setEnabled(selected); |
984 | paretoOptimalSetStabilitySpinner.setEnabled(selected); |
985 | paretoOptimalSetStabilityLabel2.setEnabled(selected); |
986 | paretoOptimalSetStabilitySpinner1.setEnabled(selected); |
987 | paretoOptimalSetStabilityLabel3.setEnabled(selected); |
988 | paretoOptimalSetStabilitySpinner2.setEnabled(selected); |
989 | |
990 | TerminationCriteriaTab.this |
991 | .updateLaunchConfigurationDialog(); |
992 | } |
993 | |
994 | }); |
995 | |
996 | Group paretoOptimalSetStabilitySettings = new Group( |
997 | this.paretoOptimalSetStabilityComposite, SWT.NONE); |
998 | paretoOptimalSetStabilitySettings.setLayout(this.twoBlocksGrid); |
999 | paretoOptimalSetStabilitySettings.setText("Configuration"); |
1000 | paretoOptimalSetStabilitySettings.setLayoutData(new GridData(SWT.FILL, |
1001 | SWT.TOP, true, false)); |
1002 | paretoOptimalSetStabilitySettings.setEnabled(true); |
1003 | |
1004 | this.paretoOptimalSetStabilityLabel = this.createLabel( |
1005 | paretoOptimalSetStabilitySettings, "Evaluation Mode: ", false, |
1006 | SWT.HORIZONTAL | SWT.LEFT, null); |
1007 | |
1008 | this.paretoOptimalSetStabilityCombo = new Combo( |
1009 | paretoOptimalSetStabilitySettings, SWT.READ_ONLY); |
1010 | this.paretoOptimalSetStabilityCombo.setEnabled(false); |
1011 | String[] items = { "EXACT_NUMBER", "PERCENTAGE" }; |
1012 | this.paretoOptimalSetStabilityCombo.setItems(items); |
1013 | this.paretoOptimalSetStabilityCombo.select(0); |
1014 | |
1015 | this.paretoOptimalSetStabilityLabel1 = this.createLabel( |
1016 | paretoOptimalSetStabilitySettings, |
1017 | "Minimum Iterations to survive: ", false, SWT.HORIZONTAL |
1018 | | SWT.LEFT, null); |
1019 | |
1020 | this.paretoOptimalSetStabilitySpinner = new Spinner( |
1021 | paretoOptimalSetStabilitySettings, SWT.NONE); |
1022 | this.paretoOptimalSetStabilitySpinner.setValues(2, 2, |
1023 | Integer.MAX_VALUE, 0, 1, 1); |
1024 | this.paretoOptimalSetStabilitySpinner.setEnabled(false); |
1025 | |
1026 | this.paretoOptimalSetStabilityLabel2 = this.createLabel( |
1027 | paretoOptimalSetStabilitySettings, |
1028 | "Exact number of survivers: ", false, |
1029 | SWT.HORIZONTAL | SWT.LEFT, null); |
1030 | |
1031 | this.paretoOptimalSetStabilitySpinner1 = new Spinner( |
1032 | paretoOptimalSetStabilitySettings, SWT.NONE); |
1033 | this.paretoOptimalSetStabilitySpinner1.setValues(1, 1, |
1034 | Integer.MAX_VALUE, 0, 1, 1); |
1035 | this.paretoOptimalSetStabilitySpinner1.setEnabled(false); |
1036 | |
1037 | this.paretoOptimalSetStabilityLabel3 = this.createLabel( |
1038 | paretoOptimalSetStabilitySettings, |
1039 | "Number of survives in percentage: ", false, SWT.HORIZONTAL |
1040 | | SWT.LEFT, null); |
1041 | |
1042 | this.paretoOptimalSetStabilitySpinner2 = new Spinner( |
1043 | paretoOptimalSetStabilitySettings, SWT.NONE); |
1044 | this.paretoOptimalSetStabilitySpinner2.setValues(0, 0, 100, 0, 1, 1); |
1045 | this.paretoOptimalSetStabilitySpinner2.setEnabled(false); |
1046 | |
1047 | this.contentMap.put(MENU_PARETO_OPTIMAL_SET_STABILITY, |
1048 | paretoOptimalSetStabilityComposite); |
1049 | |
1050 | } |
1051 | |
1052 | private void initAndAddAGivenParetoFrontIsReachedComposedContent() { |
1053 | |
1054 | this.aGivenParetoFrontIsReachedComposite = new Composite( |
1055 | this.bodyContainer, SWT.TOP); |
1056 | this.aGivenParetoFrontIsReachedComposite.setLayout(new GridLayout()); |
1057 | |
1058 | this.aGivenParetoFrontIsReachedActivate = this.createButton( |
1059 | this.aGivenParetoFrontIsReachedComposite, |
1060 | "Activate this criterion", true, SWT.CHECK, null, |
1061 | new SelectionAdapter() { |
1062 | @Override |
1063 | public void widgetSelected(SelectionEvent e) { |
1064 | // enable level and half-with fields if and only if |
1065 | // check |
1066 | // box is checked |
1067 | boolean selected = aGivenParetoFrontIsReachedActivate |
1068 | .getSelection(); |
1069 | aGivenParetoFrontIsReachedLabel.setEnabled(selected); |
1070 | aGivenParetoFrontIsReachedSpinner.setEnabled(selected); |
1071 | aGivenParetoFrontIsReachedLabel1.setEnabled(selected); |
1072 | aGivenParetoFrontIsReachedText.setEnabled(selected); |
1073 | aGivenParetoFrontIsReachedBrowse.setEnabled(selected); |
1074 | |
1075 | TerminationCriteriaTab.this |
1076 | .updateLaunchConfigurationDialog(); |
1077 | } |
1078 | |
1079 | }); |
1080 | |
1081 | Group aGivenParetoFrontIsReachedSettings = new Group( |
1082 | this.aGivenParetoFrontIsReachedComposite, SWT.NONE); |
1083 | aGivenParetoFrontIsReachedSettings.setLayout(this.threeBlocksGrid); |
1084 | aGivenParetoFrontIsReachedSettings.setText("Configuration"); |
1085 | aGivenParetoFrontIsReachedSettings.setLayoutData(new GridData(SWT.FILL, |
1086 | SWT.TOP, true, false)); |
1087 | aGivenParetoFrontIsReachedSettings.setEnabled(true); |
1088 | |
1089 | this.aGivenParetoFrontIsReachedLabel = this.createLabel( |
1090 | aGivenParetoFrontIsReachedSettings, "Percentages to cover: ", |
1091 | false, SWT.HORIZONTAL | SWT.LEFT, null); |
1092 | |
1093 | this.aGivenParetoFrontIsReachedSpinner = new Spinner( |
1094 | aGivenParetoFrontIsReachedSettings, SWT.NONE); |
1095 | this.aGivenParetoFrontIsReachedSpinner.setValues(1, 1, 100, 0, 1, 1); |
1096 | this.aGivenParetoFrontIsReachedSpinner.setEnabled(false); |
1097 | |
1098 | (this.createLabel(aGivenParetoFrontIsReachedSettings, "", true, |
1099 | SWT.HORIZONTAL | SWT.LEFT, null)).setVisible(false); |
1100 | |
1101 | this.aGivenParetoFrontIsReachedLabel1 = this.createLabel( |
1102 | aGivenParetoFrontIsReachedSettings, "Targeted Pareto Front: ", |
1103 | false, SWT.HORIZONTAL | SWT.LEFT, null); |
1104 | |
1105 | this.aGivenParetoFrontIsReachedText = new Text( |
1106 | aGivenParetoFrontIsReachedSettings, SWT.SINGLE | SWT.BORDER); |
1107 | this.aGivenParetoFrontIsReachedText.setEnabled(false); |
1108 | this.aGivenParetoFrontIsReachedText.addModifyListener(modifyListener); |
1109 | |
1110 | this.aGivenParetoFrontIsReachedBrowse = this.createButton( |
1111 | aGivenParetoFrontIsReachedSettings, "Browse", false, SWT.PUSH, |
1112 | null, new SelectionAdapter() { |
1113 | @Override |
1114 | public void widgetSelected(SelectionEvent e) { |
1115 | aGivenParetoFrontIsReachedFileDialog = new FileDialog( |
1116 | aGivenParetoFrontIsReachedBrowse.getShell()); |
1117 | aGivenParetoFrontIsReachedText |
1118 | .setText(aGivenParetoFrontIsReachedFileDialog |
1119 | .open()); |
1120 | TerminationCriteriaTab.this |
1121 | .updateLaunchConfigurationDialog(); |
1122 | } |
1123 | }); |
1124 | |
1125 | this.contentMap.put(MENU_A_GIVEN_PARETO_FRONT_IS_REACHED, |
1126 | aGivenParetoFrontIsReachedComposite); |
1127 | |
1128 | } |
1129 | |
1130 | private void initAndAddInsignificantParetoFrontChangeContent() { |
1131 | |
1132 | this.insignificantParetoFrontChangeComposite = new Composite( |
1133 | this.bodyContainer, SWT.TOP); |
1134 | this.insignificantParetoFrontChangeComposite |
1135 | .setLayout(new GridLayout()); |
1136 | |
1137 | this.insignificantParetoFrontChangeActivate = this.createButton( |
1138 | this.insignificantParetoFrontChangeComposite, |
1139 | "Activate this criterion", true, SWT.CHECK, null, |
1140 | new SelectionAdapter() { |
1141 | @Override |
1142 | public void widgetSelected(SelectionEvent e) { |
1143 | // enable level and half-with fields if and only if |
1144 | // check |
1145 | // box is checked |
1146 | boolean selected = insignificantParetoFrontChangeActivate |
1147 | .getSelection(); |
1148 | insignificantParetoFrontChangeLabel |
1149 | .setEnabled(selected); |
1150 | insignificantParetoFrontChangeSpinner |
1151 | .setEnabled(selected); |
1152 | insignificantParetoFrontChangeLabel1 |
1153 | .setEnabled(selected); |
1154 | insignificantParetoFrontChangeLabel2 |
1155 | .setEnabled(selected); |
1156 | insignificantParetoFrontChangeSpinner1 |
1157 | .setEnabled(selected); |
1158 | |
1159 | TerminationCriteriaTab.this |
1160 | .updateLaunchConfigurationDialog(); |
1161 | } |
1162 | |
1163 | }); |
1164 | |
1165 | Group insignificantParetoFrontChangeSettings = new Group( |
1166 | this.insignificantParetoFrontChangeComposite, SWT.NONE); |
1167 | insignificantParetoFrontChangeSettings.setLayout(this.threeBlocksGrid); |
1168 | insignificantParetoFrontChangeSettings.setText("Configuration"); |
1169 | insignificantParetoFrontChangeSettings.setLayoutData(new GridData( |
1170 | SWT.FILL, SWT.TOP, true, false)); |
1171 | insignificantParetoFrontChangeSettings.setEnabled(true); |
1172 | |
1173 | this.insignificantParetoFrontChangeLabel = this.createLabel( |
1174 | insignificantParetoFrontChangeSettings, "Number of the n - ", |
1175 | false, SWT.HORIZONTAL | SWT.LEFT, null); |
1176 | |
1177 | this.insignificantParetoFrontChangeSpinner = new Spinner( |
1178 | insignificantParetoFrontChangeSettings, SWT.NONE); |
1179 | this.insignificantParetoFrontChangeSpinner |
1180 | .setValues(1, 1, 100, 0, 1, 1); |
1181 | this.insignificantParetoFrontChangeSpinner.setEnabled(false); |
1182 | |
1183 | this.insignificantParetoFrontChangeLabel1 = this.createLabel( |
1184 | insignificantParetoFrontChangeSettings, " generation.", false, |
1185 | SWT.HORIZONTAL | SWT.LEFT, null); |
1186 | |
1187 | this.insignificantParetoFrontChangeLabel2 = this.createLabel( |
1188 | insignificantParetoFrontChangeSettings, |
1189 | "Minimum improvement (Persentage value);", false, |
1190 | SWT.HORIZONTAL | SWT.LEFT, null); |
1191 | |
1192 | this.insignificantParetoFrontChangeSpinner1 = new Spinner( |
1193 | insignificantParetoFrontChangeSettings, SWT.NONE); |
1194 | this.insignificantParetoFrontChangeSpinner1.setValues(1, 1, 100, 0, 1, |
1195 | 1); |
1196 | this.insignificantParetoFrontChangeSpinner1.setEnabled(false); |
1197 | |
1198 | this.contentMap.put(MENU_INSIGNIFICANT_PARETO_FRONT_CHANGE, |
1199 | insignificantParetoFrontChangeComposite); |
1200 | |
1201 | } |
1202 | |
1203 | private void initAndAddMinimalQualityCriteriaValueContent() { |
1204 | |
1205 | this.minimalQualityCriteriaValueComposite = new Composite( |
1206 | this.bodyContainer, SWT.TOP); |
1207 | this.minimalQualityCriteriaValueComposite.setLayout(new GridLayout()); |
1208 | |
1209 | this.minimalQualityCriteriaValueActivate = this.createButton( |
1210 | this.minimalQualityCriteriaValueComposite, |
1211 | "Activate this criterion", true, SWT.CHECK, null, |
1212 | new SelectionAdapter() { |
1213 | @Override |
1214 | public void widgetSelected(SelectionEvent e) { |
1215 | // enable level and half-with fields if and only if |
1216 | // check |
1217 | // box is checked |
1218 | boolean selected = minimalQualityCriteriaValueActivate |
1219 | .getSelection(); |
1220 | minimalQualityCriteriaValueLabel.setEnabled(selected); |
1221 | minimalQualityCriteriaValueSpinner.setEnabled(selected); |
1222 | minimalQualityCriteriaValueLabel1.setEnabled(selected); |
1223 | minimalQualityCriteriaValueTable.setEnabled(selected); |
1224 | minimalQualityCriteriaValueButton.setEnabled(selected); |
1225 | minimalQualityCriteriaValueButton1.setEnabled(selected); |
1226 | minimalQualityCriteriaValueButton2.setEnabled(selected); |
1227 | |
1228 | TerminationCriteriaTab.this |
1229 | .updateLaunchConfigurationDialog(); |
1230 | } |
1231 | |
1232 | }); |
1233 | |
1234 | Group minimalQualityCriteriaValueSettings = new Group( |
1235 | this.minimalQualityCriteriaValueComposite, SWT.NONE); |
1236 | minimalQualityCriteriaValueSettings.setLayout(this.threeBlocksGrid); |
1237 | minimalQualityCriteriaValueSettings.setText("Configuration"); |
1238 | minimalQualityCriteriaValueSettings.setLayoutData(new GridData( |
1239 | SWT.FILL, SWT.TOP, true, false)); |
1240 | minimalQualityCriteriaValueSettings.setEnabled(true); |
1241 | |
1242 | this.minimalQualityCriteriaValueLabel = this.createLabel( |
1243 | minimalQualityCriteriaValueSettings, |
1244 | "Number of candidates to conform: ", false, SWT.HORIZONTAL |
1245 | | SWT.LEFT, null); |
1246 | |
1247 | this.minimalQualityCriteriaValueSpinner = new Spinner( |
1248 | minimalQualityCriteriaValueSettings, SWT.NONE); |
1249 | this.minimalQualityCriteriaValueSpinner.setValues(1, 1, |
1250 | Integer.MAX_VALUE, 0, 1, 1); |
1251 | this.minimalQualityCriteriaValueSpinner.setEnabled(false); |
1252 | |
1253 | (this.createLabel(minimalQualityCriteriaValueSettings, "", true, |
1254 | SWT.HORIZONTAL | SWT.LEFT, null)).setVisible(false); |
1255 | |
1256 | this.minimalQualityCriteriaValueLabel1 = this.createLabel( |
1257 | minimalQualityCriteriaValueSettings, "Configured Objectives.", |
1258 | false, SWT.HORIZONTAL | SWT.LEFT, null); |
1259 | |
1260 | (this.createLabel(minimalQualityCriteriaValueSettings, "", true, |
1261 | SWT.HORIZONTAL | SWT.LEFT, null)).setVisible(false); |
1262 | (this.createLabel(minimalQualityCriteriaValueSettings, "", true, |
1263 | SWT.HORIZONTAL | SWT.LEFT, null)).setVisible(false); |
1264 | |
1265 | this.minimalQualityCriteriaValueTable = new Table( |
1266 | minimalQualityCriteriaValueSettings, SWT.BORDER | SWT.V_SCROLL |
1267 | | SWT.H_SCROLL); |
1268 | |
1269 | TableColumn tc1 = new TableColumn( |
1270 | this.minimalQualityCriteriaValueTable, SWT.CENTER); |
1271 | TableColumn tc2 = new TableColumn( |
1272 | this.minimalQualityCriteriaValueTable, SWT.CENTER); |
1273 | tc1.setText("Objective"); |
1274 | tc2.setText("Min Value"); |
1275 | tc1.setWidth(150); |
1276 | tc2.setWidth(150); |
1277 | this.minimalQualityCriteriaValueTable.setHeaderVisible(true); |
1278 | this.minimalQualityCriteriaValueTable.setEnabled(false); |
1279 | |
1280 | Group minimalQualityCriteriaValueSettingsButtons = new Group( |
1281 | minimalQualityCriteriaValueSettings, SWT.NONE); |
1282 | minimalQualityCriteriaValueSettingsButtons |
1283 | .setLayout(this.oneBlocksGrid); |
1284 | minimalQualityCriteriaValueSettingsButtons.setLayoutData(new GridData( |
1285 | SWT.FILL, SWT.TOP, false, false)); |
1286 | minimalQualityCriteriaValueSettingsButtons.setEnabled(true); |
1287 | |
1288 | (this.createLabel(minimalQualityCriteriaValueSettings, "", true, |
1289 | SWT.HORIZONTAL | SWT.LEFT, null)).setVisible(false); |
1290 | |
1291 | this.minimalQualityCriteriaValueButton = this.createButton( |
1292 | minimalQualityCriteriaValueSettingsButtons, "Add Objective", |
1293 | false, SWT.PUSH, null, new SelectionAdapter() { |
1294 | @Override |
1295 | public void widgetSelected(SelectionEvent e) { |
1296 | final Shell dialog = new Shell( |
1297 | minimalQualityCriteriaValueButton.getShell(), |
1298 | SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); |
1299 | dialog.setText("Configure an objective"); |
1300 | FormLayout formLayout = new FormLayout(); |
1301 | formLayout.marginWidth = 10; |
1302 | formLayout.marginHeight = 10; |
1303 | formLayout.spacing = 10; |
1304 | dialog.setLayout(formLayout); |
1305 | |
1306 | FormData data = new FormData(); |
1307 | |
1308 | Label label = createLabel(dialog, "Select Objective: ", |
1309 | true, SWT.NONE, data); |
1310 | |
1311 | final Combo objectivesCombo = new Combo(dialog, |
1312 | SWT.READ_ONLY); |
1313 | objectivesCombo.setEnabled(true); |
1314 | |
1315 | List<EvaluationAspectWithContext> objectivesList = qmlManager.getActivatedObjectives(); |
1316 | |
1317 | String[] items = new String[objectivesList.size()]; |
1318 | for (int index = 0; index < objectivesList.size(); index++) { |
1319 | items[index] = objectivesList.get(index).getCriterion().getDimension().getEntityName() + "-" + objectivesList.get(index).getCriterion().getId(); |
1320 | } |
1321 | objectivesCombo.setItems(items); |
1322 | objectivesCombo.select(0); |
1323 | data = new FormData(); |
1324 | data.top = new FormAttachment(label, 0, SWT.DEFAULT); |
1325 | objectivesCombo.setLayoutData(data); |
1326 | |
1327 | data = new FormData(); |
1328 | data.left = new FormAttachment(label, 0, SWT.DEFAULT); |
1329 | Label label1 = createLabel(dialog, "Minimal Value:", |
1330 | true, SWT.NONE, data); |
1331 | |
1332 | final Spinner minimalSpinner = new Spinner(dialog, |
1333 | SWT.NONE); |
1334 | minimalSpinner.setValues(0, 0, Integer.MAX_VALUE, 0, 1, |
1335 | 1); |
1336 | minimalSpinner.setEnabled(true); |
1337 | data = new FormData(); |
1338 | data.top = new FormAttachment(label1, 0, SWT.DEFAULT); |
1339 | data.left = new FormAttachment(objectivesCombo, 0, |
1340 | SWT.DEFAULT); |
1341 | minimalSpinner.setLayoutData(data); |
1342 | |
1343 | data = new FormData(); |
1344 | data.width = 60; |
1345 | data.right = new FormAttachment(100, 0); |
1346 | data.bottom = new FormAttachment(100, 0); |
1347 | data.top = new FormAttachment(minimalSpinner, 0, |
1348 | SWT.DEFAULT); |
1349 | Button cancel = createButton(dialog, "Cancel", true, |
1350 | SWT.PUSH, data, new SelectionAdapter() { |
1351 | @Override |
1352 | public void widgetSelected(SelectionEvent e) { |
1353 | dialog.close(); |
1354 | } |
1355 | }); |
1356 | |
1357 | data = new FormData(); |
1358 | data.width = 60; |
1359 | data.right = new FormAttachment(cancel, 0, SWT.DEFAULT); |
1360 | data.bottom = new FormAttachment(100, 0); |
1361 | Button ok = createButton(dialog, "OK", true, SWT.PUSH,data, new SelectionAdapter() { |
1362 | @Override |
1363 | public void widgetSelected(SelectionEvent e) { |
1364 | new TableItem(TerminationCriteriaTab.this.minimalQualityCriteriaValueTable,SWT.NONE).setText(new String[] {objectivesCombo.getItem(objectivesCombo.getSelectionIndex()),Integer.toString(minimalSpinner.getSelection()) }); |
1365 | dialog.close(); |
1366 | TerminationCriteriaTab.this.updateLaunchConfigurationDialog(); |
1367 | } |
1368 | }); |
1369 | |
1370 | dialog.setDefaultButton(ok); |
1371 | dialog.pack(); |
1372 | dialog.open(); |
1373 | } |
1374 | }); |
1375 | |
1376 | this.minimalQualityCriteriaValueButton1 = this.createButton( |
1377 | minimalQualityCriteriaValueSettingsButtons, "Edit Objective", |
1378 | false, SWT.PUSH, null, new SelectionAdapter() { |
1379 | @Override |
1380 | public void widgetSelected(SelectionEvent e) { |
1381 | final Shell dialog = new Shell(minimalQualityCriteriaValueButton1.getShell(),SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); |
1382 | int itemIndex = TerminationCriteriaTab.this.minimalQualityCriteriaValueTable.getSelectionIndex(); |
1383 | |
1384 | if (itemIndex < 0) { |
1385 | dialog.dispose(); |
1386 | return; |
1387 | } |
1388 | |
1389 | final TableItem item = TerminationCriteriaTab.this.minimalQualityCriteriaValueTable |
1390 | .getItem(itemIndex); |
1391 | |
1392 | dialog.setText("Edit an objective"); |
1393 | FormLayout formLayout = new FormLayout(); |
1394 | formLayout.marginWidth = 10; |
1395 | formLayout.marginHeight = 10; |
1396 | formLayout.spacing = 10; |
1397 | dialog.setLayout(formLayout); |
1398 | |
1399 | FormData data = new FormData(); |
1400 | Label label = createLabel(dialog, "Select Objective: ",true, SWT.NONE, data); |
1401 | |
1402 | data = new FormData(); |
1403 | data.top = new FormAttachment(label, 0, SWT.DEFAULT); |
1404 | Label label3 = createLabel(dialog, item.getText(0),true, SWT.NONE, data); |
1405 | |
1406 | data = new FormData(); |
1407 | data.left = new FormAttachment(label, 0, SWT.DEFAULT); |
1408 | Label label1 = createLabel(dialog, "Minimal Value:",true, SWT.NONE, data); |
1409 | |
1410 | final Spinner minimalSpinner = new Spinner(dialog, SWT.NONE); |
1411 | minimalSpinner.setValues(0, 0, Integer.MAX_VALUE, 0, 1, 1); |
1412 | minimalSpinner.setEnabled(true); |
1413 | minimalSpinner.setSelection(Integer.parseInt(item.getText(1))); |
1414 | data = new FormData(); |
1415 | data.top = new FormAttachment(label1, 0, SWT.DEFAULT); |
1416 | data.left = new FormAttachment(label3, 0, SWT.DEFAULT); |
1417 | minimalSpinner.setLayoutData(data); |
1418 | |
1419 | data = new FormData(); |
1420 | data.width = 60; |
1421 | data.right = new FormAttachment(100, 0); |
1422 | data.bottom = new FormAttachment(100, 0); |
1423 | data.top = new FormAttachment(minimalSpinner, 0, SWT.DEFAULT); |
1424 | Button cancel = createButton(dialog, "Cancel", true,SWT.PUSH, data, new SelectionAdapter() { |
1425 | @Override |
1426 | public void widgetSelected(SelectionEvent e) { |
1427 | dialog.close(); |
1428 | } |
1429 | }); |
1430 | |
1431 | data = new FormData(); |
1432 | data.width = 60; |
1433 | data.right = new FormAttachment(cancel, 0, SWT.DEFAULT); |
1434 | data.bottom = new FormAttachment(100, 0); |
1435 | |
1436 | Button ok = createButton(dialog, "OK", true, SWT.PUSH, data, new SelectionAdapter() { |
1437 | @Override |
1438 | public void widgetSelected(SelectionEvent e) { |
1439 | item.setText(1, Integer |
1440 | .toString(minimalSpinner |
1441 | .getSelection())); |
1442 | dialog.close(); |
1443 | TerminationCriteriaTab.this |
1444 | .updateLaunchConfigurationDialog(); |
1445 | } |
1446 | }); |
1447 | |
1448 | dialog.setDefaultButton(ok); |
1449 | dialog.pack(); |
1450 | dialog.open(); |
1451 | } |
1452 | }); |
1453 | |
1454 | this.minimalQualityCriteriaValueButton2 = this.createButton(minimalQualityCriteriaValueSettingsButtons, "Remove Objective", false, SWT.PUSH, null, new SelectionAdapter() { |
1455 | @Override |
1456 | public void widgetSelected(SelectionEvent e) { |
1457 | TerminationCriteriaTab.this.minimalQualityCriteriaValueTable.remove(TerminationCriteriaTab.this.minimalQualityCriteriaValueTable.getSelectionIndices()); |
1458 | TerminationCriteriaTab.this.updateLaunchConfigurationDialog(); |
1459 | } |
1460 | }); |
1461 | |
1462 | this.contentMap.put(MENU_MINIMAL_QUALITY_CRITERIA_VALUE, |
1463 | minimalQualityCriteriaValueComposite); |
1464 | |
1465 | } |
1466 | |
1467 | private void initAndAddInsignificantSetQualityImprovementContent() { |
1468 | |
1469 | this.insignificantSetQualityImprovementComposite = new Composite( |
1470 | this.bodyContainer, SWT.TOP); |
1471 | this.insignificantSetQualityImprovementComposite |
1472 | .setLayout(new GridLayout()); |
1473 | |
1474 | this.insignificantSetQualityImprovementActivate = this.createButton( |
1475 | insignificantSetQualityImprovementComposite, |
1476 | "Activate this criterion", true, SWT.CHECK, null, |
1477 | new SelectionAdapter() { |
1478 | @Override |
1479 | public void widgetSelected(SelectionEvent e) { |
1480 | // enable level and half-with fields if and only if |
1481 | // check |
1482 | // box is checked |
1483 | boolean selected = insignificantSetQualityImprovementActivate |
1484 | .getSelection(); |
1485 | insignificantSetQualityImprovementLabel |
1486 | .setEnabled(selected); |
1487 | insignificantSetQualityImprovementSpinner |
1488 | .setEnabled(selected); |
1489 | insignificantSetQualityImprovementLabel1 |
1490 | .setEnabled(selected); |
1491 | insignificantSetQualityImprovementLabel2 |
1492 | .setEnabled(selected); |
1493 | insignificantSetQualityImprovementTable |
1494 | .setEnabled(selected); |
1495 | insignificantSetQualityImprovementButton |
1496 | .setEnabled(selected); |
1497 | insignificantSetQualityImprovementButton1 |
1498 | .setEnabled(selected); |
1499 | insignificantSetQualityImprovementButton2 |
1500 | .setEnabled(selected); |
1501 | insignificantSetQualityImprovementTable |
1502 | .setEnabled(selected); |
1503 | |
1504 | TerminationCriteriaTab.this |
1505 | .updateLaunchConfigurationDialog(); |
1506 | } |
1507 | |
1508 | }); |
1509 | |
1510 | Group insignificantSetQualityImprovementSettings = new Group( |
1511 | this.insignificantSetQualityImprovementComposite, SWT.NONE); |
1512 | insignificantSetQualityImprovementSettings |
1513 | .setLayout(this.threeBlocksGrid); |
1514 | insignificantSetQualityImprovementSettings.setText("Configuration"); |
1515 | insignificantSetQualityImprovementSettings.setLayoutData(new GridData( |
1516 | SWT.FILL, SWT.TOP, true, false)); |
1517 | insignificantSetQualityImprovementSettings.setEnabled(true); |
1518 | |
1519 | Group insignificantSetQualityImprovementSettingsInternal = new Group( |
1520 | insignificantSetQualityImprovementSettings, SWT.NONE); |
1521 | insignificantSetQualityImprovementSettingsInternal |
1522 | .setLayout(this.threeBlocksGrid); |
1523 | insignificantSetQualityImprovementSettingsInternal |
1524 | .setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); |
1525 | insignificantSetQualityImprovementSettingsInternal.setEnabled(true); |
1526 | |
1527 | this.insignificantSetQualityImprovementLabel = this.createLabel( |
1528 | insignificantSetQualityImprovementSettingsInternal, |
1529 | "Number of the n - ", false, SWT.HORIZONTAL | SWT.LEFT, null); |
1530 | |
1531 | this.insignificantSetQualityImprovementSpinner = new Spinner( |
1532 | insignificantSetQualityImprovementSettingsInternal, SWT.NONE); |
1533 | this.insignificantSetQualityImprovementSpinner.setValues(1, 1, 100, 0, |
1534 | 1, 1); |
1535 | this.insignificantSetQualityImprovementSpinner.setEnabled(false); |
1536 | |
1537 | this.insignificantSetQualityImprovementLabel1 = this.createLabel(insignificantSetQualityImprovementSettingsInternal," generation.", false, SWT.HORIZONTAL | SWT.LEFT, null); |
1538 | |
1539 | (this.createLabel(insignificantSetQualityImprovementSettings, "", true, SWT.HORIZONTAL | SWT.LEFT, null)).setVisible(false); |
1540 | (this.createLabel(insignificantSetQualityImprovementSettings, "", true, SWT.HORIZONTAL | SWT.LEFT, null)).setVisible(false); |
1541 | |
1542 | this.insignificantSetQualityImprovementLabel2 = this.createLabel(insignificantSetQualityImprovementSettings, "Configured Objectives.", false, SWT.HORIZONTAL | SWT.LEFT, null); |
1543 | |
1544 | (this.createLabel(insignificantSetQualityImprovementSettings, "", true, SWT.HORIZONTAL | SWT.LEFT, null)).setVisible(false); |
1545 | (this.createLabel(insignificantSetQualityImprovementSettings, "", true, SWT.HORIZONTAL | SWT.LEFT, null)).setVisible(false); |
1546 | |
1547 | this.insignificantSetQualityImprovementTable = new Table(insignificantSetQualityImprovementSettings, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); |
1548 | |
1549 | TableColumn tc1 = new TableColumn( |
1550 | this.insignificantSetQualityImprovementTable, SWT.CENTER); |
1551 | TableColumn tc2 = new TableColumn( |
1552 | this.insignificantSetQualityImprovementTable, SWT.CENTER); |
1553 | TableColumn tc3 = new TableColumn( |
1554 | this.insignificantSetQualityImprovementTable, SWT.CENTER); |
1555 | tc1.setText("Objective"); |
1556 | tc2.setText("Average Improvemenr"); |
1557 | tc3.setText("Max/Min Value"); |
1558 | tc1.setWidth(150); |
1559 | tc2.setWidth(150); |
1560 | tc3.setWidth(150); |
1561 | this.insignificantSetQualityImprovementTable.setHeaderVisible(true); |
1562 | this.insignificantSetQualityImprovementTable.setEnabled(false); |
1563 | |
1564 | Group insignificantSetQualityImprovementSettingsButtons = new Group( |
1565 | insignificantSetQualityImprovementSettings, SWT.NONE); |
1566 | insignificantSetQualityImprovementSettingsButtons |
1567 | .setLayout(this.oneBlocksGrid); |
1568 | insignificantSetQualityImprovementSettingsButtons |
1569 | .setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); |
1570 | insignificantSetQualityImprovementSettingsButtons.setEnabled(true); |
1571 | |
1572 | (this.createLabel(insignificantSetQualityImprovementSettings, "", true, |
1573 | SWT.HORIZONTAL | SWT.LEFT, null)).setVisible(false); |
1574 | |
1575 | this.insignificantSetQualityImprovementButton = this.createButton( |
1576 | insignificantSetQualityImprovementSettingsButtons, |
1577 | "Add Objective", false, SWT.PUSH, null, new SelectionAdapter() { |
1578 | @Override |
1579 | public void widgetSelected(SelectionEvent e) { |
1580 | final Shell dialog = new Shell( |
1581 | insignificantSetQualityImprovementButton |
1582 | .getShell(), SWT.DIALOG_TRIM |
1583 | | SWT.APPLICATION_MODAL); |
1584 | dialog.setText("Configure an objective"); |
1585 | FormLayout formLayout = new FormLayout(); |
1586 | formLayout.marginWidth = 10; |
1587 | formLayout.marginHeight = 10; |
1588 | formLayout.spacing = 10; |
1589 | dialog.setLayout(formLayout); |
1590 | |
1591 | FormData data = new FormData(); |
1592 | |
1593 | Label label = createLabel(dialog, "Select Objective: ", |
1594 | true, SWT.NONE, data); |
1595 | |
1596 | final Combo objectivesCombo = new Combo(dialog, |
1597 | SWT.READ_ONLY); |
1598 | objectivesCombo.setEnabled(true); |
1599 | |
1600 | List<EvaluationAspectWithContext> objectivesList = qmlManager.getActivatedObjectives(); |
1601 | |
1602 | String[] items = new String[objectivesList.size()]; |
1603 | for (int index = 0; index < objectivesList.size(); index++) { |
1604 | items[index] = objectivesList.get(index).getCriterion().getDimension().getEntityName() + "-" + objectivesList.get(index).getCriterion().getId(); |
1605 | } |
1606 | |
1607 | objectivesCombo.setItems(items); |
1608 | objectivesCombo.select(0); |
1609 | data = new FormData(); |
1610 | data.top = new FormAttachment(label, 0, SWT.DEFAULT); |
1611 | objectivesCombo.setLayoutData(data); |
1612 | |
1613 | data = new FormData(); |
1614 | data.left = new FormAttachment(label, 0, SWT.DEFAULT); |
1615 | Label label1 = createLabel(dialog, |
1616 | "Average Improvement:", true, SWT.NONE, data); |
1617 | |
1618 | final Spinner averageSpinner = new Spinner(dialog, |
1619 | SWT.NONE); |
1620 | averageSpinner.setValues(1, 1, 100, 0, 1, 1); |
1621 | averageSpinner.setEnabled(true); |
1622 | data = new FormData(); |
1623 | data.top = new FormAttachment(label1, 0, SWT.DEFAULT); |
1624 | data.left = new FormAttachment(objectivesCombo, 0, |
1625 | SWT.DEFAULT); |
1626 | averageSpinner.setLayoutData(data); |
1627 | |
1628 | data = new FormData(); |
1629 | data.left = new FormAttachment(label1, 0, SWT.DEFAULT); |
1630 | Label label2 = createLabel(dialog, |
1631 | "Min/Max Improvement:", true, SWT.NONE, data); |
1632 | |
1633 | final Spinner minMaxSpinner = new Spinner(dialog, |
1634 | SWT.NONE); |
1635 | minMaxSpinner.setValues(1, 1, 100, 0, 1, 1); |
1636 | minMaxSpinner.setEnabled(true); |
1637 | data = new FormData(); |
1638 | data.top = new FormAttachment(label2, 0, SWT.DEFAULT); |
1639 | data.left = new FormAttachment(averageSpinner, 0, |
1640 | SWT.DEFAULT); |
1641 | minMaxSpinner.setLayoutData(data); |
1642 | |
1643 | data = new FormData(); |
1644 | data.width = 60; |
1645 | data.right = new FormAttachment(100, 0); |
1646 | data.bottom = new FormAttachment(100, 0); |
1647 | data.top = new FormAttachment(minMaxSpinner, 0, |
1648 | SWT.DEFAULT); |
1649 | |
1650 | Button cancel = createButton(dialog, "Cancel", true, |
1651 | SWT.PUSH, data, new SelectionAdapter() { |
1652 | @Override |
1653 | public void widgetSelected(SelectionEvent e) { |
1654 | dialog.close(); |
1655 | } |
1656 | }); |
1657 | |
1658 | data = new FormData(); |
1659 | data.width = 60; |
1660 | data.right = new FormAttachment(cancel, 0, SWT.DEFAULT); |
1661 | data.bottom = new FormAttachment(100, 0); |
1662 | Button ok = createButton(dialog, "OK", true, SWT.PUSH, |
1663 | data, new SelectionAdapter() { |
1664 | @Override |
1665 | public void widgetSelected(SelectionEvent e) { |
1666 | new TableItem(TerminationCriteriaTab.this.insignificantSetQualityImprovementTable,SWT.NONE) |
1667 | .setText(new String[] { objectivesCombo.getItem(objectivesCombo.getSelectionIndex()), |
1668 | Integer.toString(averageSpinner.getSelection()),Integer.toString(minMaxSpinner.getSelection()) }); |
1669 | dialog.close(); |
1670 | TerminationCriteriaTab.this.updateLaunchConfigurationDialog(); |
1671 | } |
1672 | }); |
1673 | |
1674 | dialog.setDefaultButton(ok); |
1675 | dialog.pack(); |
1676 | dialog.open(); |
1677 | } |
1678 | }); |
1679 | |
1680 | this.insignificantSetQualityImprovementButton1 = this.createButton( |
1681 | insignificantSetQualityImprovementSettingsButtons, |
1682 | "Edit Objective", false, SWT.PUSH, null, |
1683 | new SelectionAdapter() { |
1684 | @Override |
1685 | public void widgetSelected(SelectionEvent e) { |
1686 | final Shell dialog = new Shell( |
1687 | insignificantSetQualityImprovementButton |
1688 | .getShell(), SWT.DIALOG_TRIM |
1689 | | SWT.APPLICATION_MODAL); |
1690 | int itemIndex = TerminationCriteriaTab.this.insignificantSetQualityImprovementTable |
1691 | .getSelectionIndex(); |
1692 | |
1693 | if (itemIndex < 0) { |
1694 | dialog.dispose(); |
1695 | return; |
1696 | } |
1697 | |
1698 | final TableItem item = TerminationCriteriaTab.this.insignificantSetQualityImprovementTable |
1699 | .getItem(itemIndex); |
1700 | |
1701 | dialog.setText("Edit an objective"); |
1702 | FormLayout formLayout = new FormLayout(); |
1703 | formLayout.marginWidth = 10; |
1704 | formLayout.marginHeight = 10; |
1705 | formLayout.spacing = 10; |
1706 | dialog.setLayout(formLayout); |
1707 | |
1708 | FormData data = new FormData(); |
1709 | Label label = createLabel(dialog, "Select Objective: ", |
1710 | true, SWT.NONE, data); |
1711 | |
1712 | data = new FormData(); |
1713 | data.top = new FormAttachment(label, 0, SWT.DEFAULT); |
1714 | Label label3 = createLabel(dialog, item.getText(0), |
1715 | true, SWT.NONE, data); |
1716 | |
1717 | data = new FormData(); |
1718 | data.left = new FormAttachment(label, 0, SWT.DEFAULT); |
1719 | Label label1 = createLabel(dialog, |
1720 | "Average Improvement:", true, SWT.NONE, data); |
1721 | |
1722 | final Spinner averageSpinner = new Spinner(dialog, |
1723 | SWT.NONE); |
1724 | averageSpinner.setValues(1, 1, 100, 0, 1, 1); |
1725 | averageSpinner.setEnabled(true); |
1726 | averageSpinner.setSelection(Integer.parseInt(item |
1727 | .getText(1))); |
1728 | data = new FormData(); |
1729 | data.top = new FormAttachment(label1, 0, SWT.DEFAULT); |
1730 | data.left = new FormAttachment(label3, 0, SWT.DEFAULT); |
1731 | averageSpinner.setLayoutData(data); |
1732 | |
1733 | data = new FormData(); |
1734 | data.left = new FormAttachment(label1, 0, SWT.DEFAULT); |
1735 | Label label2 = createLabel(dialog, |
1736 | "Min/Max Improvement:", true, SWT.NONE, data); |
1737 | |
1738 | final Spinner minMaxSpinner = new Spinner(dialog, |
1739 | SWT.NONE); |
1740 | minMaxSpinner.setValues(1, 1, 100, 0, 1, 1); |
1741 | minMaxSpinner.setEnabled(true); |
1742 | minMaxSpinner.setSelection(Integer.parseInt(item |
1743 | .getText(2))); |
1744 | data = new FormData(); |
1745 | data.top = new FormAttachment(label2, 0, SWT.DEFAULT); |
1746 | data.left = new FormAttachment(averageSpinner, 0, |
1747 | SWT.DEFAULT); |
1748 | minMaxSpinner.setLayoutData(data); |
1749 | |
1750 | data = new FormData(); |
1751 | data.width = 60; |
1752 | data.right = new FormAttachment(100, 0); |
1753 | data.bottom = new FormAttachment(100, 0); |
1754 | data.top = new FormAttachment(minMaxSpinner, 0, |
1755 | SWT.DEFAULT); |
1756 | Button cancel = createButton(dialog, "Cencel", true, |
1757 | SWT.PUSH, data, new SelectionAdapter() { |
1758 | @Override |
1759 | public void widgetSelected(SelectionEvent e) { |
1760 | dialog.close(); |
1761 | } |
1762 | }); |
1763 | |
1764 | data = new FormData(); |
1765 | data.width = 60; |
1766 | data.right = new FormAttachment(cancel, 0, SWT.DEFAULT); |
1767 | data.bottom = new FormAttachment(100, 0); |
1768 | Button ok = createButton(dialog, "OK", true, SWT.PUSH, |
1769 | data, new SelectionAdapter() { |
1770 | @Override |
1771 | public void widgetSelected(SelectionEvent e) { |
1772 | item.setText(1, Integer |
1773 | .toString(averageSpinner |
1774 | .getSelection())); |
1775 | item.setText(2, Integer |
1776 | .toString(minMaxSpinner |
1777 | .getSelection())); |
1778 | dialog.close(); |
1779 | TerminationCriteriaTab.this |
1780 | .updateLaunchConfigurationDialog(); |
1781 | } |
1782 | }); |
1783 | |
1784 | dialog.setDefaultButton(ok); |
1785 | dialog.pack(); |
1786 | dialog.open(); |
1787 | } |
1788 | }); |
1789 | |
1790 | this.insignificantSetQualityImprovementButton2 = this.createButton( |
1791 | insignificantSetQualityImprovementSettingsButtons, |
1792 | "Remove Selected", false, SWT.PUSH, null, |
1793 | new SelectionAdapter() { |
1794 | @Override |
1795 | public void widgetSelected(SelectionEvent e) { |
1796 | TerminationCriteriaTab.this.insignificantSetQualityImprovementTable |
1797 | .remove(TerminationCriteriaTab.this.insignificantSetQualityImprovementTable |
1798 | .getSelectionIndices()); |
1799 | TerminationCriteriaTab.this |
1800 | .updateLaunchConfigurationDialog(); |
1801 | } |
1802 | }); |
1803 | |
1804 | this.contentMap.put(MENU_INSIGNIFICANT_SET_QUALITY_IMPROVEMENT, |
1805 | insignificantSetQualityImprovementComposite); |
1806 | |
1807 | } |
1808 | |
1809 | @Override |
1810 | public String getName() { |
1811 | return TAB_NAME; |
1812 | } |
1813 | |
1814 | @Override |
1815 | public void initializeFrom(ILaunchConfiguration configuration) { |
1816 | // General |
1817 | try { |
1818 | this.useTerminationCriteria |
1819 | .setSelection(configuration |
1820 | .getAttribute( |
1821 | DSEConstantsContainer.TC_GENERAL_USE_TERMINATION_CRITERIA, |
1822 | false)); |
1823 | } catch (CoreException e) { |
1824 | RunConfigPlugin.errorLogger(getName(), |
1825 | DSEConstantsContainer.TC_GENERAL_USE_TERMINATION_CRITERIA, |
1826 | e.getMessage()); |
1827 | } |
1828 | |
1829 | try { |
1830 | this.runInComparisionMode.setSelection(configuration.getAttribute( |
1831 | DSEConstantsContainer.TC_GENERAL_COMPARISION_MODE, false)); |
1832 | } catch (CoreException e) { |
1833 | RunConfigPlugin.errorLogger(getName(), |
1834 | DSEConstantsContainer.TC_GENERAL_COMPARISION_MODE, e |
1835 | .getMessage()); |
1836 | } |
1837 | |
1838 | // Composed Criteria |
1839 | try { |
1840 | this.activateComposedCriteria |
1841 | .setSelection(configuration |
1842 | .getAttribute( |
1843 | DSEConstantsContainer.TC_COMPOSED_CRITERIA_ACTIVATE, |
1844 | false)); |
1845 | } catch (CoreException e) { |
1846 | RunConfigPlugin.errorLogger(getName(), |
1847 | DSEConstantsContainer.TC_COMPOSED_CRITERIA_ACTIVATE, e |
1848 | .getMessage()); |
1849 | } |
1850 | |
1851 | try { |
1852 | this.composedExpression.setText(configuration.getAttribute( |
1853 | DSEConstantsContainer.TC_COMPOSED_CRITERIA_EXPRESSION, "")); |
1854 | } catch (CoreException e) { |
1855 | RunConfigPlugin.errorLogger(getName(), |
1856 | DSEConstantsContainer.TC_COMPOSED_CRITERIA_EXPRESSION, e |
1857 | .getMessage()); |
1858 | } |
1859 | |
1860 | // Maximum Generation Number Criterion |
1861 | try { |
1862 | this.maxGenNumActivate.setSelection(configuration.getAttribute( |
1863 | DSEConstantsContainer.TC_MAX_NUM_OF_GEN_ACTIVATE, false)); |
1864 | } catch (CoreException e) { |
1865 | RunConfigPlugin.errorLogger(getName(), |
1866 | DSEConstantsContainer.TC_MAX_NUM_OF_GEN_ACTIVATE, e |
1867 | .getMessage()); |
1868 | } |
1869 | |
1870 | try { |
1871 | this.maxGenNumSpinner.setSelection(configuration.getAttribute( |
1872 | DSEConstantsContainer.TC_MAX_NUM_OF_GEN_LIMIT, 1)); |
1873 | } catch (CoreException e) { |
1874 | RunConfigPlugin.errorLogger(getName(), |
1875 | DSEConstantsContainer.TC_MAX_NUM_OF_GEN_LIMIT, e |
1876 | .getMessage()); |
1877 | } |
1878 | |
1879 | // Elapsed Time Criterion |
1880 | try { |
1881 | this.elapsedTimeActivate.setSelection(configuration.getAttribute( |
1882 | DSEConstantsContainer.TC_ELAPSED_TIME_ACTIVATE, false)); |
1883 | } catch (CoreException e) { |
1884 | RunConfigPlugin.errorLogger(getName(), |
1885 | DSEConstantsContainer.TC_ELAPSED_TIME_ACTIVATE, e |
1886 | .getMessage()); |
1887 | } |
1888 | |
1889 | try { |
1890 | if (!configuration.getAttribute( |
1891 | DSEConstantsContainer.TC_ELAPSED_TIME_TYPE, "USER_TIME") |
1892 | .equalsIgnoreCase("CPU_TIME")) { |
1893 | this.elapsedTimeCombo.select(0); |
1894 | } else { |
1895 | this.elapsedTimeCombo.select(1); |
1896 | } |
1897 | } catch (CoreException e) { |
1898 | RunConfigPlugin.errorLogger(getName(), |
1899 | DSEConstantsContainer.TC_ELAPSED_TIME_TYPE, e.getMessage()); |
1900 | } |
1901 | |
1902 | try { |
1903 | this.elapsedTimeSpinner.setSelection(configuration.getAttribute( |
1904 | DSEConstantsContainer.TC_ELAPSED_TIME_TIME_LIMIT, 1)); |
1905 | } catch (CoreException e) { |
1906 | RunConfigPlugin.errorLogger(getName(), |
1907 | DSEConstantsContainer.TC_ELAPSED_TIME_TIME_LIMIT, e |
1908 | .getMessage()); |
1909 | } |
1910 | |
1911 | // No New Pareto Optimal Candidates Found Criterion |
1912 | try { |
1913 | this.noNewParetoOptimalCandidatesFoundActivate |
1914 | .setSelection(configuration |
1915 | .getAttribute( |
1916 | DSEConstantsContainer.TC_NO_NEW_CANDIDATES_ACTIVATE, |
1917 | false)); |
1918 | } catch (CoreException e) { |
1919 | RunConfigPlugin.errorLogger(getName(), |
1920 | DSEConstantsContainer.TC_NO_NEW_CANDIDATES_ACTIVATE, e |
1921 | .getMessage()); |
1922 | } |
1923 | |
1924 | try { |
1925 | this.noNewParetoOptimalCandidatesFoundSpinner |
1926 | .setSelection(configuration |
1927 | .getAttribute( |
1928 | DSEConstantsContainer.TC_NO_NEW_CANDIDATES_ITERATIONS_WITHOUT, |
1929 | 1)); |
1930 | } catch (CoreException e) { |
1931 | RunConfigPlugin |
1932 | .errorLogger( |
1933 | getName(), |
1934 | DSEConstantsContainer.TC_NO_NEW_CANDIDATES_ITERATIONS_WITHOUT, |
1935 | e.getMessage()); |
1936 | } |
1937 | |
1938 | // Pareto Optimal Set Stability |
1939 | try { |
1940 | this.paretoOptimalSetStabilityActivate.setSelection(configuration |
1941 | .getAttribute( |
1942 | DSEConstantsContainer.TC_SET_STABILITY_ACTIVATE, |
1943 | false)); |
1944 | } catch (CoreException e) { |
1945 | RunConfigPlugin.errorLogger(getName(), |
1946 | DSEConstantsContainer.TC_SET_STABILITY_ACTIVATE, e |
1947 | .getMessage()); |
1948 | } |
1949 | |
1950 | try { |
1951 | if (!configuration |
1952 | .getAttribute(DSEConstantsContainer.TC_SET_STABILITY_MODE, |
1953 | "EXACT_NUMBER").equalsIgnoreCase("PERCENTAGE")) { |
1954 | this.paretoOptimalSetStabilityCombo.select(0); |
1955 | } else { |
1956 | this.paretoOptimalSetStabilityCombo.select(1); |
1957 | } |
1958 | } catch (CoreException e) { |
1959 | RunConfigPlugin |
1960 | .errorLogger(getName(), |
1961 | DSEConstantsContainer.TC_SET_STABILITY_MODE, e |
1962 | .getMessage()); |
1963 | } |
1964 | |
1965 | try { |
1966 | this.paretoOptimalSetStabilitySpinner |
1967 | .setSelection(configuration |
1968 | .getAttribute( |
1969 | DSEConstantsContainer.TC_SET_STABILITY_MINIMUM_ITERATION_TO_SURVIVE, |
1970 | 1)); |
1971 | } catch (CoreException e) { |
1972 | RunConfigPlugin |
1973 | .errorLogger( |
1974 | getName(), |
1975 | DSEConstantsContainer.TC_SET_STABILITY_MINIMUM_ITERATION_TO_SURVIVE, |
1976 | e.getMessage()); |
1977 | } |
1978 | |
1979 | try { |
1980 | this.paretoOptimalSetStabilitySpinner1 |
1981 | .setSelection(configuration |
1982 | .getAttribute( |
1983 | DSEConstantsContainer.TC_SET_STABILITY_NUMBER_OF_SURVIVORS_EXACT, |
1984 | 1)); |
1985 | } catch (CoreException e) { |
1986 | RunConfigPlugin |
1987 | .errorLogger( |
1988 | getName(), |
1989 | DSEConstantsContainer.TC_SET_STABILITY_NUMBER_OF_SURVIVORS_EXACT, |
1990 | e.getMessage()); |
1991 | } |
1992 | |
1993 | try { |
1994 | this.paretoOptimalSetStabilitySpinner2 |
1995 | .setSelection(configuration |
1996 | .getAttribute( |
1997 | DSEConstantsContainer.TC_SET_STABILITY_NUMBER_OF_SURVIVORS_PERCENTAGE, |
1998 | 1)); |
1999 | } catch (CoreException e) { |
2000 | RunConfigPlugin |
2001 | .errorLogger( |
2002 | getName(), |
2003 | DSEConstantsContainer.TC_SET_STABILITY_NUMBER_OF_SURVIVORS_PERCENTAGE, |
2004 | e.getMessage()); |
2005 | } |
2006 | |
2007 | // Minimal Quality Criteria Value |
2008 | try { |
2009 | this.minimalQualityCriteriaValueActivate.setSelection(configuration |
2010 | .getAttribute( |
2011 | DSEConstantsContainer.TC_MINIMAL_VALUES_ACTIVATE, |
2012 | false)); |
2013 | } catch (CoreException e) { |
2014 | RunConfigPlugin.errorLogger(getName(), |
2015 | DSEConstantsContainer.TC_MINIMAL_VALUES_ACTIVATE, e |
2016 | .getMessage()); |
2017 | } |
2018 | |
2019 | try { |
2020 | this.minimalQualityCriteriaValueSpinner |
2021 | .setSelection(configuration |
2022 | .getAttribute( |
2023 | DSEConstantsContainer.TC_MINIMAL_VALUES_CANDIDATES_TO_CONFORM, |
2024 | 1)); |
2025 | } catch (CoreException e) { |
2026 | RunConfigPlugin |
2027 | .errorLogger( |
2028 | getName(), |
2029 | DSEConstantsContainer.TC_MINIMAL_VALUES_CANDIDATES_TO_CONFORM, |
2030 | e.getMessage()); |
2031 | } |
2032 | |
2033 | this.minimalQualityCriteriaValueTable.removeAll(); |
2034 | |
2035 | String tableItems = ""; |
2036 | |
2037 | try { |
2038 | tableItems = configuration |
2039 | .getAttribute( |
2040 | DSEConstantsContainer.TC_MINIMAL_VALUES_CONFIGURED_OBJECTIVES, |
2041 | ""); |
2042 | } catch (CoreException e) { |
2043 | RunConfigPlugin |
2044 | .errorLogger( |
2045 | getName(), |
2046 | DSEConstantsContainer.TC_MINIMAL_VALUES_CONFIGURED_OBJECTIVES, |
2047 | e.getMessage()); |
2048 | } |
2049 | |
2050 | if (!tableItems.isEmpty()) { |
2051 | String[] items = tableItems.split(";"); |
2052 | for (String item : items) { |
2053 | String[] values = item.split("\\|"); |
2054 | new TableItem(this.minimalQualityCriteriaValueTable, SWT.NONE) |
2055 | .setText(new String[] { values[0], values[1] }); |
2056 | } |
2057 | } |
2058 | |
2059 | // A Given Pareto Front is Reached |
2060 | try { |
2061 | this.aGivenParetoFrontIsReachedActivate |
2062 | .setSelection(configuration |
2063 | .getAttribute( |
2064 | DSEConstantsContainer.TC_PARETO_FRONT_IS_REACHED_ACTIVATE, |
2065 | false)); |
2066 | } catch (CoreException e) { |
2067 | RunConfigPlugin.errorLogger(getName(), |
2068 | DSEConstantsContainer.TC_PARETO_FRONT_IS_REACHED_ACTIVATE, |
2069 | e.getMessage()); |
2070 | } |
2071 | |
2072 | try { |
2073 | this.aGivenParetoFrontIsReachedSpinner |
2074 | .setSelection(configuration |
2075 | .getAttribute( |
2076 | DSEConstantsContainer.TC_PARETO_FRONT_IS_REACHED_PERCENTAGES_TO_COVER, |
2077 | 1)); |
2078 | } catch (CoreException e) { |
2079 | RunConfigPlugin |
2080 | .errorLogger( |
2081 | getName(), |
2082 | DSEConstantsContainer.TC_PARETO_FRONT_IS_REACHED_PERCENTAGES_TO_COVER, |
2083 | e.getMessage()); |
2084 | } |
2085 | |
2086 | try { |
2087 | this.aGivenParetoFrontIsReachedText |
2088 | .setText(configuration |
2089 | .getAttribute( |
2090 | DSEConstantsContainer.TC_PARETO_FRONT_IS_REACHED_PATH_TO_FRONT_FILE, |
2091 | "")); |
2092 | } catch (CoreException e) { |
2093 | RunConfigPlugin |
2094 | .errorLogger( |
2095 | getName(), |
2096 | DSEConstantsContainer.TC_PARETO_FRONT_IS_REACHED_PATH_TO_FRONT_FILE, |
2097 | e.getMessage()); |
2098 | } |
2099 | |
2100 | // Insignificant Set Quality Improvement |
2101 | try { |
2102 | this.insignificantSetQualityImprovementActivate |
2103 | .setSelection(configuration |
2104 | .getAttribute( |
2105 | DSEConstantsContainer.TC_INSIGNIFICANT_SET_IMPROVEMENT_ACTIVATE, |
2106 | false)); |
2107 | } catch (CoreException e) { |
2108 | RunConfigPlugin |
2109 | .errorLogger( |
2110 | getName(), |
2111 | DSEConstantsContainer.TC_INSIGNIFICANT_SET_IMPROVEMENT_ACTIVATE, |
2112 | e.getMessage()); |
2113 | } |
2114 | |
2115 | try { |
2116 | this.insignificantSetQualityImprovementSpinner |
2117 | .setSelection(configuration |
2118 | .getAttribute( |
2119 | DSEConstantsContainer.TC_INSIGNIFICANT_SET_IMPROVEMENT_GENERATION_X, |
2120 | 1)); |
2121 | } catch (CoreException e) { |
2122 | RunConfigPlugin |
2123 | .errorLogger( |
2124 | getName(), |
2125 | DSEConstantsContainer.TC_INSIGNIFICANT_SET_IMPROVEMENT_GENERATION_X, |
2126 | e.getMessage()); |
2127 | } |
2128 | |
2129 | this.insignificantSetQualityImprovementTable.removeAll(); |
2130 | |
2131 | String tableItems2 = ""; |
2132 | |
2133 | try { |
2134 | tableItems2 = configuration |
2135 | .getAttribute( |
2136 | DSEConstantsContainer.TC_INSIGNIFICANT_SET_IMPROVEMENT_CONFIGURED_OBJECTIVES, |
2137 | ""); |
2138 | } catch (CoreException e) { |
2139 | RunConfigPlugin |
2140 | .errorLogger( |
2141 | getName(), |
2142 | DSEConstantsContainer.TC_INSIGNIFICANT_SET_IMPROVEMENT_CONFIGURED_OBJECTIVES, |
2143 | e.getMessage()); |
2144 | } |
2145 | |
2146 | if (!tableItems2.isEmpty()) { |
2147 | String[] items = tableItems2.split("\\;"); |
2148 | for (String item : items) { |
2149 | String[] values = item.split("\\|"); |
2150 | new TableItem(this.insignificantSetQualityImprovementTable, |
2151 | SWT.NONE).setText(new String[] { values[0], values[1], |
2152 | values[2] }); |
2153 | } |
2154 | } |
2155 | |
2156 | // Insignificant Pareto Front Change |
2157 | try { |
2158 | this.insignificantParetoFrontChangeActivate |
2159 | .setSelection(configuration |
2160 | .getAttribute( |
2161 | DSEConstantsContainer.TC_INSIGNIFICANT_FRONT_CHANGE_ACTIVATE, |
2162 | false)); |
2163 | } catch (CoreException e) { |
2164 | RunConfigPlugin |
2165 | .errorLogger( |
2166 | getName(), |
2167 | DSEConstantsContainer.TC_INSIGNIFICANT_FRONT_CHANGE_ACTIVATE, |
2168 | e.getMessage()); |
2169 | } |
2170 | |
2171 | try { |
2172 | this.insignificantParetoFrontChangeSpinner |
2173 | .setSelection(configuration |
2174 | .getAttribute( |
2175 | DSEConstantsContainer.TC_INSIGNIFICANT_FRONT_CHANGE_GENERATION_X, |
2176 | 1)); |
2177 | } catch (CoreException e) { |
2178 | RunConfigPlugin |
2179 | .errorLogger( |
2180 | getName(), |
2181 | DSEConstantsContainer.TC_INSIGNIFICANT_FRONT_CHANGE_GENERATION_X, |
2182 | e.getMessage()); |
2183 | } |
2184 | |
2185 | try { |
2186 | this.insignificantParetoFrontChangeSpinner1 |
2187 | .setSelection(configuration |
2188 | .getAttribute( |
2189 | DSEConstantsContainer.TC_INSIGNIFICANT_FRONT_CHANGE_IMPROVEMENT, |
2190 | 1)); |
2191 | } catch (CoreException e) { |
2192 | RunConfigPlugin |
2193 | .errorLogger( |
2194 | getName(), |
2195 | DSEConstantsContainer.TC_INSIGNIFICANT_FRONT_CHANGE_IMPROVEMENT, |
2196 | e.getMessage()); |
2197 | } |
2198 | |
2199 | this.updateAvailabilities(); |
2200 | } |
2201 | |
2202 | private void updateAvailabilities() { |
2203 | boolean selected = activateComposedCriteria.getSelection(); |
2204 | expAnd.setEnabled(selected); |
2205 | expOr.setEnabled(selected); |
2206 | expNot.setEnabled(selected); |
2207 | expBrackets.setEnabled(selected); |
2208 | expCrit.setEnabled(selected); |
2209 | composedExpression.setEnabled(selected); |
2210 | expValidate.setEnabled(selected); |
2211 | expressionIsValid.setEnabled(selected); |
2212 | |
2213 | selected = maxGenNumActivate.getSelection(); |
2214 | maxGenNumLabel.setEnabled(selected); |
2215 | maxGenNumSpinner.setEnabled(selected); |
2216 | |
2217 | selected = elapsedTimeActivate.getSelection(); |
2218 | elapsedTimeLabel.setEnabled(selected); |
2219 | elapsedTimeLabel2.setEnabled(selected); |
2220 | elapsedTimeSpinner.setEnabled(selected); |
2221 | elapsedTimeCombo.setEnabled(selected); |
2222 | |
2223 | selected = noNewParetoOptimalCandidatesFoundActivate.getSelection(); |
2224 | noNewParetoOptimalCandidatesFoundLabel.setEnabled(selected); |
2225 | noNewParetoOptimalCandidatesFoundSpinner.setEnabled(selected); |
2226 | |
2227 | selected = paretoOptimalSetStabilityActivate.getSelection(); |
2228 | paretoOptimalSetStabilityLabel.setEnabled(selected); |
2229 | paretoOptimalSetStabilityCombo.setEnabled(selected); |
2230 | paretoOptimalSetStabilityLabel1.setEnabled(selected); |
2231 | paretoOptimalSetStabilitySpinner.setEnabled(selected); |
2232 | paretoOptimalSetStabilityLabel2.setEnabled(selected); |
2233 | paretoOptimalSetStabilitySpinner1.setEnabled(selected); |
2234 | paretoOptimalSetStabilityLabel3.setEnabled(selected); |
2235 | paretoOptimalSetStabilitySpinner2.setEnabled(selected); |
2236 | |
2237 | selected = aGivenParetoFrontIsReachedActivate.getSelection(); |
2238 | aGivenParetoFrontIsReachedLabel.setEnabled(selected); |
2239 | aGivenParetoFrontIsReachedSpinner.setEnabled(selected); |
2240 | aGivenParetoFrontIsReachedLabel1.setEnabled(selected); |
2241 | aGivenParetoFrontIsReachedText.setEnabled(selected); |
2242 | aGivenParetoFrontIsReachedBrowse.setEnabled(selected); |
2243 | |
2244 | selected = insignificantParetoFrontChangeActivate.getSelection(); |
2245 | insignificantParetoFrontChangeLabel.setEnabled(selected); |
2246 | insignificantParetoFrontChangeSpinner.setEnabled(selected); |
2247 | insignificantParetoFrontChangeLabel1.setEnabled(selected); |
2248 | insignificantParetoFrontChangeLabel2.setEnabled(selected); |
2249 | insignificantParetoFrontChangeSpinner1.setEnabled(selected); |
2250 | |
2251 | selected = minimalQualityCriteriaValueActivate.getSelection(); |
2252 | minimalQualityCriteriaValueLabel.setEnabled(selected); |
2253 | minimalQualityCriteriaValueSpinner.setEnabled(selected); |
2254 | minimalQualityCriteriaValueLabel1.setEnabled(selected); |
2255 | minimalQualityCriteriaValueTable.setEnabled(selected); |
2256 | minimalQualityCriteriaValueButton.setEnabled(selected); |
2257 | minimalQualityCriteriaValueButton1.setEnabled(selected); |
2258 | minimalQualityCriteriaValueButton2.setEnabled(selected); |
2259 | |
2260 | selected = insignificantSetQualityImprovementActivate.getSelection(); |
2261 | insignificantSetQualityImprovementLabel.setEnabled(selected); |
2262 | insignificantSetQualityImprovementSpinner.setEnabled(selected); |
2263 | insignificantSetQualityImprovementLabel1.setEnabled(selected); |
2264 | insignificantSetQualityImprovementLabel2.setEnabled(selected); |
2265 | insignificantSetQualityImprovementTable.setEnabled(selected); |
2266 | insignificantSetQualityImprovementButton.setEnabled(selected); |
2267 | insignificantSetQualityImprovementButton1.setEnabled(selected); |
2268 | insignificantSetQualityImprovementButton2.setEnabled(selected); |
2269 | insignificantSetQualityImprovementTable.setEnabled(selected); |
2270 | } |
2271 | |
2272 | @Override |
2273 | public void performApply(ILaunchConfigurationWorkingCopy configuration) { |
2274 | // General |
2275 | configuration.setAttribute( |
2276 | DSEConstantsContainer.TC_GENERAL_USE_TERMINATION_CRITERIA, |
2277 | this.useTerminationCriteria.getSelection()); |
2278 | configuration.setAttribute( |
2279 | DSEConstantsContainer.TC_GENERAL_COMPARISION_MODE, |
2280 | this.runInComparisionMode.getSelection()); |
2281 | |
2282 | // Composed Criteria |
2283 | configuration.setAttribute( |
2284 | DSEConstantsContainer.TC_COMPOSED_CRITERIA_ACTIVATE, |
2285 | this.activateComposedCriteria.getSelection()); |
2286 | configuration.setAttribute( |
2287 | DSEConstantsContainer.TC_COMPOSED_CRITERIA_EXPRESSION, |
2288 | this.composedExpression.getText()); |
2289 | |
2290 | // Maximum Generation Number Criterion |
2291 | configuration.setAttribute( |
2292 | DSEConstantsContainer.TC_MAX_NUM_OF_GEN_ACTIVATE, |
2293 | this.maxGenNumActivate.getSelection()); |
2294 | configuration.setAttribute( |
2295 | DSEConstantsContainer.TC_MAX_NUM_OF_GEN_LIMIT, |
2296 | this.maxGenNumSpinner.getSelection()); |
2297 | |
2298 | // Elapsed Time Criterion |
2299 | configuration.setAttribute( |
2300 | DSEConstantsContainer.TC_ELAPSED_TIME_ACTIVATE, |
2301 | this.elapsedTimeActivate.getSelection()); |
2302 | configuration.setAttribute(DSEConstantsContainer.TC_ELAPSED_TIME_TYPE, |
2303 | this.elapsedTimeCombo.getItem(this.elapsedTimeCombo |
2304 | .getSelectionIndex())); |
2305 | configuration.setAttribute( |
2306 | DSEConstantsContainer.TC_ELAPSED_TIME_TIME_LIMIT, |
2307 | this.elapsedTimeSpinner.getSelection()); |
2308 | |
2309 | // No New Pareto Candidates Found Criterion |
2310 | configuration.setAttribute( |
2311 | DSEConstantsContainer.TC_NO_NEW_CANDIDATES_ACTIVATE, |
2312 | this.noNewParetoOptimalCandidatesFoundActivate.getSelection()); |
2313 | configuration.setAttribute( |
2314 | DSEConstantsContainer.TC_NO_NEW_CANDIDATES_ITERATIONS_WITHOUT, |
2315 | this.noNewParetoOptimalCandidatesFoundSpinner.getSelection()); |
2316 | |
2317 | // Pareto Optimal Set Stability |
2318 | configuration.setAttribute( |
2319 | DSEConstantsContainer.TC_SET_STABILITY_ACTIVATE, |
2320 | this.paretoOptimalSetStabilityActivate.getSelection()); |
2321 | configuration.setAttribute(DSEConstantsContainer.TC_SET_STABILITY_MODE, |
2322 | this.paretoOptimalSetStabilityCombo |
2323 | .getItem(this.paretoOptimalSetStabilityCombo |
2324 | .getSelectionIndex())); |
2325 | configuration |
2326 | .setAttribute( |
2327 | DSEConstantsContainer.TC_SET_STABILITY_MINIMUM_ITERATION_TO_SURVIVE, |
2328 | this.paretoOptimalSetStabilitySpinner.getSelection()); |
2329 | configuration |
2330 | .setAttribute( |
2331 | DSEConstantsContainer.TC_SET_STABILITY_NUMBER_OF_SURVIVORS_EXACT, |
2332 | this.paretoOptimalSetStabilitySpinner1.getSelection()); |
2333 | configuration |
2334 | .setAttribute( |
2335 | DSEConstantsContainer.TC_SET_STABILITY_NUMBER_OF_SURVIVORS_PERCENTAGE, |
2336 | this.paretoOptimalSetStabilitySpinner2.getSelection()); |
2337 | |
2338 | // Minimal Quality Criteria Value |
2339 | configuration.setAttribute( |
2340 | DSEConstantsContainer.TC_MINIMAL_VALUES_ACTIVATE, |
2341 | this.minimalQualityCriteriaValueActivate.getSelection()); |
2342 | configuration.setAttribute( |
2343 | DSEConstantsContainer.TC_MINIMAL_VALUES_CANDIDATES_TO_CONFORM, |
2344 | this.minimalQualityCriteriaValueSpinner.getSelection()); |
2345 | this.minimalQualityCriteriaValueTable.getItems(); |
2346 | |
2347 | StringBuilder tableItems = new StringBuilder(); |
2348 | |
2349 | for (int i = 0; i < this.minimalQualityCriteriaValueTable |
2350 | .getItemCount(); i++) { |
2351 | tableItems.append(this.minimalQualityCriteriaValueTable.getItem(i) |
2352 | .getText(0) |
2353 | + "|" |
2354 | + this.minimalQualityCriteriaValueTable.getItem(i).getText( |
2355 | 1) + ";"); |
2356 | } |
2357 | |
2358 | configuration.setAttribute( |
2359 | DSEConstantsContainer.TC_MINIMAL_VALUES_CONFIGURED_OBJECTIVES, |
2360 | tableItems.toString()); |
2361 | |
2362 | // A Given Pareto Front is Reached |
2363 | configuration.setAttribute( |
2364 | DSEConstantsContainer.TC_PARETO_FRONT_IS_REACHED_ACTIVATE, |
2365 | this.aGivenParetoFrontIsReachedActivate.getSelection()); |
2366 | configuration |
2367 | .setAttribute( |
2368 | DSEConstantsContainer.TC_PARETO_FRONT_IS_REACHED_PERCENTAGES_TO_COVER, |
2369 | this.aGivenParetoFrontIsReachedSpinner.getSelection()); |
2370 | configuration |
2371 | .setAttribute( |
2372 | DSEConstantsContainer.TC_PARETO_FRONT_IS_REACHED_PATH_TO_FRONT_FILE, |
2373 | this.aGivenParetoFrontIsReachedText.getText()); |
2374 | |
2375 | // Insignificant Set Quality Improvement |
2376 | configuration |
2377 | .setAttribute( |
2378 | DSEConstantsContainer.TC_INSIGNIFICANT_SET_IMPROVEMENT_ACTIVATE, |
2379 | this.insignificantSetQualityImprovementActivate |
2380 | .getSelection()); |
2381 | configuration |
2382 | .setAttribute( |
2383 | DSEConstantsContainer.TC_INSIGNIFICANT_SET_IMPROVEMENT_GENERATION_X, |
2384 | this.insignificantSetQualityImprovementSpinner |
2385 | .getSelection()); |
2386 | |
2387 | StringBuilder tableItems2 = new StringBuilder(); |
2388 | TableItem[] items = this.insignificantSetQualityImprovementTable |
2389 | .getItems(); |
2390 | for (int i = 0; i < items.length; i++) { |
2391 | tableItems2.append(items[i].getText(0) + "|" + items[i].getText(1) |
2392 | + "|" + items[i].getText(2) + ";"); |
2393 | } |
2394 | |
2395 | configuration |
2396 | .setAttribute( |
2397 | DSEConstantsContainer.TC_INSIGNIFICANT_SET_IMPROVEMENT_CONFIGURED_OBJECTIVES, |
2398 | tableItems2.toString()); |
2399 | |
2400 | // Insignificant Pareto Front Change |
2401 | configuration.setAttribute( |
2402 | DSEConstantsContainer.TC_INSIGNIFICANT_FRONT_CHANGE_ACTIVATE, |
2403 | this.insignificantParetoFrontChangeActivate.getSelection()); |
2404 | configuration |
2405 | .setAttribute( |
2406 | DSEConstantsContainer.TC_INSIGNIFICANT_FRONT_CHANGE_GENERATION_X, |
2407 | this.insignificantParetoFrontChangeSpinner |
2408 | .getSelection()); |
2409 | configuration |
2410 | .setAttribute( |
2411 | DSEConstantsContainer.TC_INSIGNIFICANT_FRONT_CHANGE_IMPROVEMENT, |
2412 | this.insignificantParetoFrontChangeSpinner1 |
2413 | .getSelection()); |
2414 | |
2415 | } |
2416 | |
2417 | @Override |
2418 | public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { |
2419 | // TODO Auto-generated method stub |
2420 | |
2421 | } |
2422 | |
2423 | } |