| 1 | package de.uka.ipd.sdq.dsexplore.analysis.lqn.launch; |
| 2 | |
| 3 | import org.eclipse.debug.core.ILaunchConfiguration; |
| 4 | import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
| 5 | import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; |
| 6 | import org.eclipse.debug.ui.ILaunchConfigurationDialog; |
| 7 | import org.eclipse.debug.ui.ILaunchConfigurationTab; |
| 8 | import org.eclipse.swt.SWT; |
| 9 | import org.eclipse.swt.widgets.Composite; |
| 10 | import org.eclipse.swt.widgets.Event; |
| 11 | |
| 12 | import de.uka.ipd.sdq.pcmsolver.runconfig.MainConfigTab; |
| 13 | import de.uka.ipd.sdq.pcmsolver.runconfig.MessageStrings; |
| 14 | import de.uka.ipd.sdq.workflow.pcm.runconfig.ConfigurationTab; |
| 15 | |
| 16 | /** |
| 17 | * Provides a configuration tab group for the LQN Solver analysis method. |
| 18 | * |
| 19 | * @author pmerkle |
| 20 | * |
| 21 | */ |
| 22 | public class LQNAnalysisTabGroup extends AbstractLaunchConfigurationTabGroup { |
| 23 | |
| 24 | public void createTabs(ILaunchConfigurationDialog dialog, String mode) { |
| 25 | ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] { |
| 26 | new MainConfigTabExt(), |
| 27 | new ConfigurationTab() |
| 28 | }; |
| 29 | setTabs(tabs); |
| 30 | |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * This class extends the {@link MainConfigTab} in order to support |
| 35 | * disabling of the solver selection combo. |
| 36 | * |
| 37 | * @author pmerkle |
| 38 | * |
| 39 | */ |
| 40 | private class MainConfigTabExt extends MainConfigTab { |
| 41 | |
| 42 | @Override |
| 43 | public void createControl(Composite parent) { |
| 44 | super.createControl(parent); |
| 45 | |
| 46 | comboSolver.setEnabled(false); |
| 47 | comboLqnsOutput.setEnabled(false); |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public void initializeFrom(ILaunchConfiguration configuration) { |
| 52 | super.initializeFrom(configuration); |
| 53 | |
| 54 | // set LQN Solver as default, if not done yet |
| 55 | if (!comboSolver.getText().equals(MessageStrings.LQNS_SOLVER)) { |
| 56 | String[] solverItems = comboSolver.getItems(); |
| 57 | for (int i = 0; i < solverItems.length; i++) { |
| 58 | String str = solverItems[i]; |
| 59 | if (str.equals(MessageStrings.LQNS_SOLVER)) { |
| 60 | comboSolver.select(i); |
| 61 | comboSolver.notifyListeners(SWT.Selection, new Event()); |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // set XML Output as default, if not done yet |
| 67 | if (!comboLqnsOutput.getText().equals(MessageStrings.LQN_OUTPUT_XML)) { |
| 68 | String[] outputItems = comboLqnsOutput.getItems(); |
| 69 | for (int i = 0; i < outputItems.length; i++) { |
| 70 | String str = outputItems[i]; |
| 71 | if (str.equals(MessageStrings.LQN_OUTPUT_XML)) { |
| 72 | comboLqnsOutput.select(i); |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * {@inheritDoc} |
| 81 | */ |
| 82 | @Override |
| 83 | public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { |
| 84 | super.setDefaults(configuration); |
| 85 | |
| 86 | configuration.setAttribute(MessageStrings.SOLVER, |
| 87 | MessageStrings.LQNS_SOLVER); |
| 88 | configuration.setAttribute(MessageStrings.LQNS_OUTPUT, |
| 89 | MessageStrings.LQN_OUTPUT_XML); |
| 90 | } |
| 91 | |
| 92 | } |
| 93 | |
| 94 | } |