Search in sources :

Example 1 with AbstractLaunchConfigurationTab

use of org.eclipse.debug.ui.AbstractLaunchConfigurationTab in project linuxtools by eclipse.

the class AbstractProfilingOptionsTab method performApply.

@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
    // make sure tabs are not null, and the tab's controls have been
    // initialized.
    Boolean isInitialized = initialized.get(getProviderId());
    isInitialized = (isInitialized != null) ? isInitialized : false;
    if (tabs != null && isInitialized) {
        for (AbstractLaunchConfigurationTab tab : tabs) {
            tab.performApply(configuration);
        }
    }
}
Also used : AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab)

Example 2 with AbstractLaunchConfigurationTab

use of org.eclipse.debug.ui.AbstractLaunchConfigurationTab in project linuxtools by eclipse.

the class RemoteProxyProfileLaunchConfigurationTabGroup method createTabs.

@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
    ArrayList<AbstractLaunchConfigurationTab> tabs = new ArrayList<>();
    tabs.add(new RemoteProxyCMainTab());
    tabs.add(new CArgumentsTab());
    tabs.addAll(Arrays.asList(getProfileTabs()));
    tabs.add(new EnvironmentTab());
    tabs.add(new SourceLookupTab());
    tabs.add(new CommonTab());
    setTabs(tabs.toArray(new AbstractLaunchConfigurationTab[tabs.size()]));
}
Also used : CArgumentsTab(org.eclipse.cdt.launch.ui.CArgumentsTab) AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab) ArrayList(java.util.ArrayList) EnvironmentTab(org.eclipse.debug.ui.EnvironmentTab) SourceLookupTab(org.eclipse.debug.ui.sourcelookup.SourceLookupTab) CommonTab(org.eclipse.debug.ui.CommonTab)

Example 3 with AbstractLaunchConfigurationTab

use of org.eclipse.debug.ui.AbstractLaunchConfigurationTab in project linuxtools by eclipse.

the class AbstractProfilingOptionsTab method isValid.

@Override
public boolean isValid(ILaunchConfiguration config) {
    String provider;
    try {
        provider = config.getAttribute(ProviderProfileConstants.PROVIDER_CONFIG_ATT, // $NON-NLS-1$
        "");
    } catch (CoreException e) {
        setErrorMessage(e.getMessage());
        return false;
    }
    if (provider.isEmpty()) {
        setErrorMessage(Messages.ProfilingTab_providerid_not_found);
        return false;
    }
    Boolean isInitialized = initialized.get(getProviderId());
    if (isInitialized) {
        // Tabs should not be null after initialization.
        if (tabs == null) {
            return false;
        }
        // Validate tab configurations of underlying tool.
        for (AbstractLaunchConfigurationTab tab : tabs) {
            if (!tab.isValid(config)) {
                setErrorMessage(tab.getErrorMessage());
                return false;
            }
        }
    } else {
        if (tabs != null) {
            // use their state to determine whether config is valid
            for (AbstractLaunchConfigurationTab tab : tabs) {
                if (!tab.isValid(config)) {
                    return false;
                }
            }
        }
    }
    setErrorMessage(null);
    return true;
}
Also used : AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab) CoreException(org.eclipse.core.runtime.CoreException)

Example 4 with AbstractLaunchConfigurationTab

use of org.eclipse.debug.ui.AbstractLaunchConfigurationTab in project linuxtools by eclipse.

the class AbstractProfilingOptionsTab method initializeFrom.

@Override
public void initializeFrom(ILaunchConfiguration configuration) {
    /**
     * First time the configuration is selected.
     *
     * This is a cheap way to get access to the launch configuration. Our
     * tabs are loaded dynamically, so the tab group doesn't "know" about
     * them. We get access to this launch configuration to ensure that we
     * can properly load the widgets the first time.
     */
    // update current configuration (initial) with configuration being
    // passed in
    initial = configuration;
    // check if there exists a launch provider id in the configuration
    if (initial != null) {
        try {
            String providerId = initial.getAttribute(ProviderProfileConstants.PROVIDER_CONFIG_ATT, (String) null);
            // load provider corresponding to specified ids
            loadTabGroupItems(tabgroup, providerId);
        } catch (CoreException e) {
        // continue, initialize tabs
        }
    }
    if (tabs != null) {
        for (AbstractLaunchConfigurationTab tab : tabs) {
            tab.initializeFrom(configuration);
        }
    }
    // finished initialization
    initialized.put(getProviderId(), true);
}
Also used : AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab) CoreException(org.eclipse.core.runtime.CoreException)

Example 5 with AbstractLaunchConfigurationTab

use of org.eclipse.debug.ui.AbstractLaunchConfigurationTab in project linuxtools by eclipse.

the class ProviderLaunchConfigurationDelegate method launch.

@Override
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    if (config != null) {
        // get provider id from configuration.
        String providerId = config.getAttribute(ProviderProfileConstants.PROVIDER_CONFIG_ATT, // $NON-NLS-1$
        "");
        String providerToolName = config.getAttribute(ProviderProfileConstants.PROVIDER_CONFIG_TOOLNAME_ATT, // $NON-NLS-1$
        "");
        if (providerId == null || providerId.isEmpty()) {
            // $NON-NLS-1$
            String cProjectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
            if (cProjectName != null && !cProjectName.isEmpty()) {
                // We have a previously created C/C++ run/debug configuration and now Linux Tools
                // profiling framework has been added.  Find a suitable default provider id to use
                // and perform initialization prior to profiling.
                String defaultType = null;
                String[] categories = ProviderFramework.getProviderCategories();
                if (categories.length == 0) {
                    infoDialog(Messages.ProviderNoProfilers_title_0, Messages.ProviderNoProfilers_msg_0);
                    return;
                }
                for (String category : categories) {
                    // Give precedence to timing category if present
                    if (category.equals("timing")) {
                        // $NON-NLS-1$
                        // $NON-NLS-1$
                        defaultType = "timing";
                    }
                }
                // if default category still not set, take first one found
                if (defaultType == null)
                    defaultType = categories[0];
                providerId = ProviderFramework.getProviderIdToRun(null, defaultType);
                ProfileLaunchConfigurationTabGroup tabGroupConfig = ProviderFramework.getTabGroupProviderFromId(providerId);
                if (tabGroupConfig == null) {
                    infoDialog(Messages.ProviderNoProfilers_title_0, Messages.ProviderNoProfilers_msg_0);
                    return;
                }
                AbstractLaunchConfigurationTab[] tabs = tabGroupConfig.getProfileTabs();
                // Set up defaults according to profiling tabs.  We must use a working copy
                // to do this which we save at the end to the original copy.
                ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
                for (ILaunchConfigurationTab tab : tabs) {
                    tab.setDefaults(wc);
                }
                config = wc.doSave();
            }
        }
        // get delegate associated with provider id.
        AbstractCLaunchDelegate delegate = ProviderFramework.getConfigurationDelegateFromId(providerId);
        // launch delegate
        if (delegate != null) {
            try {
                delegate.launch(config, mode, launch, monitor);
            } catch (CoreException e) {
                errorDialog(Messages.ProviderLaunchError_msg_0, e.getMessage());
            }
        } else {
            String message = providerToolName.isEmpty() ? NLS.bind(Messages.ProviderProfilerMissing_msg_0, providerId) : NLS.bind(Messages.ProviderProfilerMissing_msg_1, providerToolName);
            infoDialog(Messages.ProviderProfilerMissing_title_0, message);
        }
    }
}
Also used : AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab) CoreException(org.eclipse.core.runtime.CoreException) ProfileLaunchConfigurationTabGroup(org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) AbstractCLaunchDelegate(org.eclipse.cdt.launch.AbstractCLaunchDelegate) ILaunchConfigurationTab(org.eclipse.debug.ui.ILaunchConfigurationTab)

Aggregations

AbstractLaunchConfigurationTab (org.eclipse.debug.ui.AbstractLaunchConfigurationTab)6 CoreException (org.eclipse.core.runtime.CoreException)3 ArrayList (java.util.ArrayList)2 CArgumentsTab (org.eclipse.cdt.launch.ui.CArgumentsTab)2 CommonTab (org.eclipse.debug.ui.CommonTab)2 EnvironmentTab (org.eclipse.debug.ui.EnvironmentTab)2 SourceLookupTab (org.eclipse.debug.ui.sourcelookup.SourceLookupTab)2 AbstractCLaunchDelegate (org.eclipse.cdt.launch.AbstractCLaunchDelegate)1 CMainTab2 (org.eclipse.cdt.launch.ui.CMainTab2)1 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)1 ILaunchConfigurationTab (org.eclipse.debug.ui.ILaunchConfigurationTab)1 ProfileLaunchConfigurationTabGroup (org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup)1