use of org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory in project linuxtools by eclipse.
the class OprofileSetupTab method createControl.
@Override
public void createControl(Composite parent) {
options = new LaunchOptions();
Composite top = new Composite(parent, SWT.NONE);
setControl(top);
top.setLayout(new GridLayout());
GridData data;
GridLayout layout;
createVerticalSpacer(top, 1);
// Create container for kernel image file selection
Composite p = new Composite(top, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
layout.marginWidth = 0;
p.setLayout(layout);
data = new GridData(GridData.FILL_HORIZONTAL);
p.setLayoutData(data);
Label l2 = new Label(p, SWT.NONE);
// $NON-NLS-1$
l2.setText(OprofileLaunchMessages.getString("tab.global.select"));
data = new GridData();
data.horizontalSpan = 2;
l2.setLayoutData(data);
controlCombo = new CCombo(p, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
List<String> tools = new ArrayList<>(Arrays.asList(OprofileProject.OPERF_BINARY));
/*
* Check if tools are installed. Use whichComand() method from
* RuntimeProcessFactory as it considers the LinuxTools Path.
*/
IProject project = getOprofileProject();
try {
String toolPath = RuntimeProcessFactory.getFactory().whichCommand(OprofileProject.OCOUNT_BINARY, project);
// Command found
if (!toolPath.equals(OprofileProject.OCOUNT_BINARY)) {
tools.add(OprofileProject.OCOUNT_BINARY);
}
} catch (Exception e) {
}
controlCombo.setItems(tools.toArray(new String[0]));
controlCombo.select(0);
controlCombo.addModifyListener(mev -> {
OprofileProject.setProfilingBinary(controlCombo.getText());
options.setOprofileComboText(controlCombo.getText());
enableOptionWidgets();
updateLaunchConfigurationDialog();
});
data = new GridData();
data.horizontalSpan = 2;
controlCombo.setLayoutData(data);
kernelLabel = new Label(p, SWT.NONE);
// $NON-NLS-1$
kernelLabel.setText(OprofileLaunchMessages.getString("tab.global.kernelImage.label.text"));
kernelLabel.setEnabled(false);
data = new GridData();
data.horizontalSpan = 2;
kernelLabel.setLayoutData(data);
kernelImageFileText = new Text(p, SWT.SINGLE | SWT.BORDER);
data = new GridData(GridData.FILL_HORIZONTAL);
kernelImageFileText.setLayoutData(data);
kernelImageFileText.addModifyListener(mev -> handleKernelImageFileTextModify(kernelImageFileText));
// $NON-NLS-1$
Button button = createPushButton(p, OprofileLaunchMessages.getString("tab.global.kernelImage.browse.button.text"), null);
final Shell shell = top.getShell();
button.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> showFileDialog(shell)));
createVerticalSpacer(top, 1);
// Create checkbox options container
p = new Composite(top, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = 0;
layout.marginWidth = 0;
p.setLayout(layout);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
p.setLayoutData(data);
// $NON-NLS-1$
checkSeparateLibrary = myCreateCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateLibrary.text"));
// $NON-NLS-1$
checkSeparateKernel = myCreateCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateKernel.text"));
// Number of executions spinner
Composite executionsComposite = new Composite(top, SWT.NONE);
GridLayout gridLayout = new GridLayout(2, false);
executionsComposite.setLayout(gridLayout);
executionsSpinnerLabel = new Label(executionsComposite, SWT.LEFT);
// $NON-NLS-1$
executionsSpinnerLabel.setText(OprofileLaunchMessages.getString("tab.global.executionsNumber.label.text"));
// $NON-NLS-1$
executionsSpinnerLabel.setToolTipText(OprofileLaunchMessages.getString("tab.global.executionsNumber.label.tooltip"));
executionsSpinner = new Spinner(executionsComposite, SWT.BORDER);
executionsSpinner.setMinimum(1);
executionsSpinner.addModifyListener(e -> {
options.setExecutionsNumber(executionsSpinner.getSelection());
updateLaunchConfigurationDialog();
});
}
Aggregations