|
Lines 22-28
Link Here
|
| 22 |
import org.eclipse.debug.ui.ILaunchConfigurationDialog; |
22 |
import org.eclipse.debug.ui.ILaunchConfigurationDialog; |
| 23 |
import org.eclipse.debug.ui.ILaunchConfigurationTab; |
23 |
import org.eclipse.debug.ui.ILaunchConfigurationTab; |
| 24 |
import org.eclipse.ptp.core.util.LaunchUtils; |
24 |
import org.eclipse.ptp.core.util.LaunchUtils; |
|
|
25 |
import org.eclipse.ptp.etfw.Activator; |
| 25 |
import org.eclipse.ptp.etfw.IToolLaunchConfigurationConstants; |
26 |
import org.eclipse.ptp.etfw.IToolLaunchConfigurationConstants; |
|
|
27 |
import org.eclipse.ptp.etfw.PreferenceConstants; |
| 26 |
import org.eclipse.ptp.etfw.jaxb.JAXBInitializationUtil; |
28 |
import org.eclipse.ptp.etfw.jaxb.JAXBInitializationUtil; |
| 27 |
import org.eclipse.ptp.etfw.jaxb.data.BuildToolType; |
29 |
import org.eclipse.ptp.etfw.jaxb.data.BuildToolType; |
| 28 |
import org.eclipse.ptp.etfw.jaxb.data.EtfwToolProcessType; |
30 |
import org.eclipse.ptp.etfw.jaxb.data.EtfwToolProcessType; |
|
Lines 38-43
Link Here
|
| 38 |
import org.eclipse.ptp.launch.ui.extensions.IRMLaunchConfigurationContentsChangedListener; |
40 |
import org.eclipse.ptp.launch.ui.extensions.IRMLaunchConfigurationContentsChangedListener; |
| 39 |
import org.eclipse.ptp.launch.ui.extensions.IRMLaunchConfigurationDynamicTab; |
41 |
import org.eclipse.ptp.launch.ui.extensions.IRMLaunchConfigurationDynamicTab; |
| 40 |
import org.eclipse.ptp.launch.ui.extensions.JAXBDynamicLaunchConfigurationTab; |
42 |
import org.eclipse.ptp.launch.ui.extensions.JAXBDynamicLaunchConfigurationTab; |
|
|
43 |
import org.eclipse.ptp.remote.core.Preferences; |
| 41 |
import org.eclipse.ptp.rm.jaxb.control.core.ILaunchController; |
44 |
import org.eclipse.ptp.rm.jaxb.control.core.ILaunchController; |
| 42 |
import org.eclipse.ptp.rm.jaxb.control.core.LaunchControllerManager; |
45 |
import org.eclipse.ptp.rm.jaxb.control.core.LaunchControllerManager; |
| 43 |
import org.eclipse.ptp.rm.jaxb.control.ui.IUpdateModel; |
46 |
import org.eclipse.ptp.rm.jaxb.control.ui.IUpdateModel; |
|
Lines 86-99
Link Here
|
| 86 |
private Composite topComposite; |
89 |
private Composite topComposite; |
| 87 |
private Composite toolComposite; |
90 |
private Composite toolComposite; |
| 88 |
private Composite bottomComposite; |
91 |
private Composite bottomComposite; |
| 89 |
private Combo etfwCombo; |
|
|
| 90 |
private Combo toolCombo; |
92 |
private Combo toolCombo; |
| 91 |
private Label selectToolLbl; |
93 |
private Label selectToolLbl; |
| 92 |
private Button buildOnlyCheck; |
94 |
private Button buildOnlyCheck; |
| 93 |
private Button analyzeonlyCheck; |
95 |
private Button analyzeonlyCheck; |
| 94 |
private String controlId; |
96 |
private String controlId; |
| 95 |
private Button addWorkflowButton; |
|
|
| 96 |
private Button removeWorkflowButton; |
| 97 |
// I believe this should be part of the launchTabParent, but there is RM specifics that must be removed |
97 |
// I believe this should be part of the launchTabParent, but there is RM specifics that must be removed |
| 98 |
private final LinkedList<IJAXBLaunchConfigurationTab> tabControllers = new LinkedList<IJAXBLaunchConfigurationTab>(); |
98 |
private final LinkedList<IJAXBLaunchConfigurationTab> tabControllers = new LinkedList<IJAXBLaunchConfigurationTab>(); |
| 99 |
private final ContentsChangedListener launchContentsChangedListener = new ContentsChangedListener(); |
99 |
private final ContentsChangedListener launchContentsChangedListener = new ContentsChangedListener(); |
|
Lines 127-154
Link Here
|
| 127 |
topComposite.setLayout(new GridLayout(2, false)); |
127 |
topComposite.setLayout(new GridLayout(2, false)); |
| 128 |
topComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
128 |
topComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
| 129 |
|
129 |
|
| 130 |
Label whichETFWLbl = new Label(topComposite, SWT.NONE); |
|
|
| 131 |
whichETFWLbl.setText(IETFWLaunchConfigurationConstants.ETFW_VERSION); |
| 132 |
|
| 133 |
etfwCombo = new Combo(topComposite, SWT.READ_ONLY); |
| 134 |
etfwCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
| 135 |
etfwCombo.setItems(new String[] { IETFWLaunchConfigurationConstants.SAX_PARSER, |
| 136 |
IETFWLaunchConfigurationConstants.JAXB_PARSER }); |
| 137 |
etfwCombo.select(1); |
| 138 |
etfwCombo.addSelectionListener(new SelectionAdapter() { |
| 139 |
|
| 140 |
@Override |
| 141 |
public void widgetSelected(SelectionEvent e) { |
| 142 |
if (etfwCombo.getSelectionIndex() == 0) { |
| 143 |
buildSAXParserETFW(); |
| 144 |
} else { |
| 145 |
buildJAXBParserETFW(); |
| 146 |
} |
| 147 |
} |
| 148 |
}); |
| 149 |
|
| 150 |
buildNewETFW(); |
| 151 |
|
| 152 |
toolComposite = new Composite(content, SWT.NONE); |
130 |
toolComposite = new Composite(content, SWT.NONE); |
| 153 |
toolComposite.setLayout(new FillLayout()); |
131 |
toolComposite.setLayout(new FillLayout()); |
| 154 |
toolComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
132 |
toolComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
|
Lines 162-224
Link Here
|
| 162 |
|
140 |
|
| 163 |
analyzeonlyCheck = new Button(bottomComposite, SWT.CHECK); |
141 |
analyzeonlyCheck = new Button(bottomComposite, SWT.CHECK); |
| 164 |
analyzeonlyCheck.setText(Messages.PerformanceAnalysisTab_SelectExistingPerfData); |
142 |
analyzeonlyCheck.setText(Messages.PerformanceAnalysisTab_SelectExistingPerfData); |
|
|
143 |
|
| 144 |
String parser = Preferences.getString(Activator.PLUGIN_ID, PreferenceConstants.ETFW_VERSION); |
| 145 |
if (parser.equals(IToolLaunchConfigurationConstants.USE_SAX_PARSER)) { |
| 146 |
buildSAXParserUI(); |
| 147 |
} else { |
| 148 |
buildJAXBParserUI(); |
| 149 |
} |
| 165 |
} |
150 |
} |
| 166 |
|
151 |
|
| 167 |
private void buildNewETFW() { |
152 |
private void buildSAXParserUI() { |
| 168 |
clearOldWidgets(); |
|
|
| 169 |
|
| 170 |
selectToolLbl = new Label(topComposite, SWT.NONE); |
| 171 |
selectToolLbl.setText("Select tool: "); //$NON-NLS-1$ |
| 172 |
|
| 173 |
toolCombo = new Combo(topComposite, SWT.READ_ONLY); |
| 174 |
toolCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
| 175 |
String[] toolNames = JAXBExtensionUtils.getToolNames(); |
| 176 |
for (String name : toolNames) { |
| 177 |
toolCombo.add(name); |
| 178 |
} |
| 179 |
|
| 180 |
toolCombo.addSelectionListener(listener); |
| 181 |
|
| 182 |
addWorkflowButton = new Button(topComposite, SWT.PUSH); |
| 183 |
addWorkflowButton.setText("Add Workflow"); //$NON-NLS-1$ |
| 184 |
|
| 185 |
removeWorkflowButton = new Button(topComposite, SWT.PUSH); |
| 186 |
removeWorkflowButton.setText("Remove Workflow"); //$NON-NLS-1$ |
| 187 |
} |
| 188 |
|
| 189 |
private void buildJAXBParserETFW() { |
| 190 |
buildNewETFW(); |
| 191 |
bottomComposite.setVisible(true); |
| 192 |
String toolName; |
| 193 |
try { |
| 194 |
toolName = this.launchConfiguration.getAttribute("selected_performance_tool", ""); //$NON-NLS-1$ //$NON-NLS-2$ |
| 195 |
if (!toolName.isEmpty()) { |
| 196 |
for (int index = 0; index < toolCombo.getItemCount(); index++) { |
| 197 |
if (toolCombo.getItem(index).equals(toolName)) { |
| 198 |
toolCombo.select(index); |
| 199 |
toolCombo.notifyListeners(SWT.Selection, null); |
| 200 |
break; |
| 201 |
} |
| 202 |
|
| 203 |
} |
| 204 |
} |
| 205 |
} catch (CoreException e) { |
| 206 |
e.printStackTrace(); |
| 207 |
} |
| 208 |
|
| 209 |
} |
| 210 |
|
| 211 |
private void buildSAXParserETFW() { |
| 212 |
for (Control child : toolComposite.getChildren()) { |
| 213 |
child.dispose(); |
| 214 |
} |
| 215 |
|
| 216 |
clearOldWidgets(); |
| 217 |
bottomComposite.setVisible(false); |
153 |
bottomComposite.setVisible(false); |
| 218 |
|
154 |
|
| 219 |
saxETFWTab = new ExternalToolSelectionTab(true); |
155 |
saxETFWTab = new ExternalToolSelectionTab(true); |
| 220 |
saxETFWTab.createControl(toolComposite); |
156 |
saxETFWTab.createControl(toolComposite); |
| 221 |
saxETFWTab.initializeFrom(this.launchConfiguration); |
|
|
| 222 |
saxETFWTab.setLaunchConfigurationDialog(this.getLaunchConfigurationDialog()); |
157 |
saxETFWTab.setLaunchConfigurationDialog(this.getLaunchConfigurationDialog()); |
| 223 |
|
158 |
|
| 224 |
toolComposite.getParent().layout(); |
159 |
toolComposite.getParent().layout(); |
|
Lines 226-232
Link Here
|
| 226 |
toolComposite.layout(); |
161 |
toolComposite.layout(); |
| 227 |
} |
162 |
} |
| 228 |
|
163 |
|
|
|
164 |
private void buildJAXBParserUI() { |
| 165 |
selectToolLbl = new Label(topComposite, SWT.NONE); |
| 166 |
selectToolLbl.setText(Messages.PerformanceAnalysisTab_SelectTool); |
| 167 |
|
| 168 |
toolCombo = new Combo(topComposite, SWT.READ_ONLY); |
| 169 |
toolCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
| 170 |
String[] toolNames = JAXBExtensionUtils.getToolNames(); |
| 171 |
toolCombo.add(Messages.PerformanceAnalysisTab_PleaseSelectWorkflow); |
| 172 |
for (String name : toolNames) { |
| 173 |
toolCombo.add(name); |
| 174 |
} |
| 175 |
|
| 176 |
toolCombo.addSelectionListener(listener); |
| 177 |
toolCombo.select(0); |
| 178 |
|
| 179 |
toolComposite.getParent().layout(); |
| 180 |
topComposite.layout(); |
| 181 |
toolComposite.layout(); |
| 182 |
} |
| 183 |
|
| 229 |
private void rebuildTab(String toolName) { |
184 |
private void rebuildTab(String toolName) { |
|
|
185 |
if (toolName.equals(Messages.PerformanceAnalysisTab_PleaseSelectWorkflow)) { |
| 186 |
clearOldWidgets(); |
| 187 |
return; |
| 188 |
} |
| 230 |
etfwTool = JAXBExtensionUtils.getTool(toolName); |
189 |
etfwTool = JAXBExtensionUtils.getTool(toolName); |
| 231 |
vmap = new ETFWVariableMap(); |
190 |
vmap = new ETFWVariableMap(); |
| 232 |
|
191 |
|
|
Lines 391-412
Link Here
|
| 391 |
controller = LaunchControllerManager.getInstance().getLaunchController(remId, remName, rmType); |
350 |
controller = LaunchControllerManager.getInstance().getLaunchController(remId, remName, rmType); |
| 392 |
if (controller != null) { |
351 |
if (controller != null) { |
| 393 |
controlId = controller.getControlId(); |
352 |
controlId = controller.getControlId(); |
| 394 |
|
353 |
String parser = Preferences.getString(Activator.PLUGIN_ID, PreferenceConstants.ETFW_VERSION); |
| 395 |
String toolName = configuration.getAttribute(IToolLaunchConfigurationConstants.SELECTED_TOOL, |
354 |
if (parser.equals(IToolLaunchConfigurationConstants.USE_SAX_PARSER)) { |
| 396 |
IToolLaunchConfigurationConstants.EMPTY_STRING); |
355 |
// buildSAXParserUI(); |
| 397 |
if (!toolName.isEmpty()) { |
356 |
saxETFWTab.initializeFrom(configuration); |
| 398 |
if (etfwCombo.getSelectionIndex() == 1) { |
357 |
} else { |
| 399 |
|
358 |
String toolName = configuration.getAttribute(IToolLaunchConfigurationConstants.SELECTED_TOOL, |
| 400 |
for (int index = 0; index < toolCombo.getItemCount(); index++) { |
359 |
IToolLaunchConfigurationConstants.EMPTY_STRING); |
| 401 |
if (toolCombo.getItem(index).equals(toolName)) { |
360 |
for (int index = 0; index < toolCombo.getItemCount(); index++) { |
| 402 |
toolCombo.select(index); |
361 |
if (toolCombo.getItem(index).equals(toolName)) { |
| 403 |
toolCombo.notifyListeners(SWT.Selection, null); |
362 |
toolCombo.select(index); |
| 404 |
break; |
363 |
toolCombo.notifyListeners(SWT.Selection, null); |
| 405 |
} |
364 |
break; |
| 406 |
|
|
|
| 407 |
} |
365 |
} |
| 408 |
} |
366 |
} |
| 409 |
|
|
|
| 410 |
} |
367 |
} |
| 411 |
} |
368 |
} |
| 412 |
} catch (CoreException e) { |
369 |
} catch (CoreException e) { |
|
Lines 417-430
Link Here
|
| 417 |
@Override |
374 |
@Override |
| 418 |
public void performApply(ILaunchConfigurationWorkingCopy configuration) { |
375 |
public void performApply(ILaunchConfigurationWorkingCopy configuration) { |
| 419 |
|
376 |
|
| 420 |
if (etfwCombo.getSelectionIndex() == 0) { |
377 |
String parser = Preferences.getString(Activator.PLUGIN_ID, PreferenceConstants.ETFW_VERSION); |
| 421 |
configuration |
378 |
configuration.setAttribute(IToolLaunchConfigurationConstants.ETFW_VERSION, parser); |
| 422 |
.setAttribute(IToolLaunchConfigurationConstants.ETFW_VERSION, IToolLaunchConfigurationConstants.USE_SAX_PARSER); |
379 |
if (parser.equals(IToolLaunchConfigurationConstants.USE_SAX_PARSER)) { |
| 423 |
saxETFWTab.performApply(configuration); |
380 |
saxETFWTab.performApply(configuration); |
| 424 |
} else { |
381 |
} else { |
| 425 |
configuration.setAttribute(IToolLaunchConfigurationConstants.ETFW_VERSION, |
382 |
if (toolCombo.getSelectionIndex() > 0) { |
| 426 |
IToolLaunchConfigurationConstants.USE_JAXB_PARSER); |
|
|
| 427 |
if (toolCombo.getSelectionIndex() != -1) { |
| 428 |
String selectedtool = toolCombo.getItem(toolCombo.getSelectionIndex()); |
383 |
String selectedtool = toolCombo.getItem(toolCombo.getSelectionIndex()); |
| 429 |
configuration.setAttribute(SELECTED_TOOL, selectedtool); |
384 |
configuration.setAttribute(SELECTED_TOOL, selectedtool); |
| 430 |
|
385 |
|
|
Lines 484-495
Link Here
|
| 484 |
} |
439 |
} |
| 485 |
|
440 |
|
| 486 |
private void clearOldWidgets() { |
441 |
private void clearOldWidgets() { |
| 487 |
if (selectToolLbl != null) { |
442 |
for (Control child : toolComposite.getChildren()) { |
| 488 |
selectToolLbl.dispose(); |
443 |
child.dispose(); |
| 489 |
toolCombo.dispose(); |
|
|
| 490 |
addWorkflowButton.dispose(); |
| 491 |
removeWorkflowButton.dispose(); |
| 492 |
} |
444 |
} |
|
|
445 |
|
| 493 |
} |
446 |
} |
| 494 |
|
447 |
|
| 495 |
/** |
448 |
/** |
|
Lines 497-503
Link Here
|
| 497 |
*/ |
450 |
*/ |
| 498 |
@Override |
451 |
@Override |
| 499 |
public String getName() { |
452 |
public String getName() { |
| 500 |
return "Performance Analysis"; //$NON-NLS-1$ |
453 |
return Messages.PerformanceAnalysisTab_Tab_Name; |
| 501 |
} |
454 |
} |
| 502 |
|
455 |
|
| 503 |
@Override |
456 |
@Override |
|
Lines 516-522
Link Here
|
| 516 |
@Override |
469 |
@Override |
| 517 |
public boolean isValid(ILaunchConfiguration configuration) { |
470 |
public boolean isValid(ILaunchConfiguration configuration) { |
| 518 |
setErrorMessage(null); |
471 |
setErrorMessage(null); |
| 519 |
if (launchTabParent != null) { |
472 |
|
|
|
473 |
if (toolCombo != null) { |
| 474 |
if (toolCombo.getSelectionIndex() == 0) { |
| 475 |
setErrorMessage(Messages.PerformanceAnalysisTab_NoWorkflowSelected); |
| 476 |
return false; |
| 477 |
} |
| 478 |
} |
| 479 |
else if (launchTabParent != null) { |
| 520 |
String error = launchTabParent.getUpdateHandler().getFirstError(); |
480 |
String error = launchTabParent.getUpdateHandler().getFirstError(); |
| 521 |
if (error != null) { |
481 |
if (error != null) { |
| 522 |
setErrorMessage(error); |
482 |
setErrorMessage(error); |