Search in sources :

Example 1 with RuntimeProcessFactory

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();
    });
}
Also used : Arrays(java.util.Arrays) ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) Image(org.eclipse.swt.graphics.Image) CoreException(org.eclipse.core.runtime.CoreException) Oprofile(org.eclipse.linuxtools.internal.oprofile.core.Oprofile) Spinner(org.eclipse.swt.widgets.Spinner) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) IProject(org.eclipse.core.resources.IProject) AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab) Composite(org.eclipse.swt.widgets.Composite) OprofileLaunchPlugin(org.eclipse.linuxtools.internal.oprofile.launch.OprofileLaunchPlugin) RemoteProxyManager(org.eclipse.linuxtools.profiling.launch.RemoteProxyManager) GridData(org.eclipse.swt.layout.GridData) IFileStore(org.eclipse.core.filesystem.IFileStore) CCombo(org.eclipse.swt.custom.CCombo) Text(org.eclipse.swt.widgets.Text) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) FileDialog(org.eclipse.swt.widgets.FileDialog) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) List(java.util.List) OprofileDaemonOptions(org.eclipse.linuxtools.internal.oprofile.core.daemon.OprofileDaemonOptions) ICDTLaunchConfigurationConstants(org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants) IRemoteFileProxy(org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy) OprofileLaunchMessages(org.eclipse.linuxtools.internal.oprofile.launch.OprofileLaunchMessages) SWT(org.eclipse.swt.SWT) MessageBox(org.eclipse.swt.widgets.MessageBox) OprofileProject(org.eclipse.linuxtools.internal.oprofile.core.Oprofile.OprofileProject) RuntimeProcessFactory(org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory) Label(org.eclipse.swt.widgets.Label) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Spinner(org.eclipse.swt.widgets.Spinner) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) Text(org.eclipse.swt.widgets.Text) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) GridLayout(org.eclipse.swt.layout.GridLayout) Shell(org.eclipse.swt.widgets.Shell) CCombo(org.eclipse.swt.custom.CCombo) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Aggregations

MessageFormat (java.text.MessageFormat)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 ICDTLaunchConfigurationConstants (org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants)1 IFileStore (org.eclipse.core.filesystem.IFileStore)1 IProject (org.eclipse.core.resources.IProject)1 ResourcesPlugin (org.eclipse.core.resources.ResourcesPlugin)1 CoreException (org.eclipse.core.runtime.CoreException)1 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)1 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)1 AbstractLaunchConfigurationTab (org.eclipse.debug.ui.AbstractLaunchConfigurationTab)1 Oprofile (org.eclipse.linuxtools.internal.oprofile.core.Oprofile)1 OprofileProject (org.eclipse.linuxtools.internal.oprofile.core.Oprofile.OprofileProject)1 OprofileDaemonOptions (org.eclipse.linuxtools.internal.oprofile.core.daemon.OprofileDaemonOptions)1 OprofileLaunchMessages (org.eclipse.linuxtools.internal.oprofile.launch.OprofileLaunchMessages)1 OprofileLaunchPlugin (org.eclipse.linuxtools.internal.oprofile.launch.OprofileLaunchPlugin)1 IRemoteFileProxy (org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy)1 RemoteProxyManager (org.eclipse.linuxtools.profiling.launch.RemoteProxyManager)1 RuntimeProcessFactory (org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory)1