Java Code Examples for org.eclipse.debug.core.DebugPlugin#getLaunchManager()

The following examples show how to use org.eclipse.debug.core.DebugPlugin#getLaunchManager() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleRunner.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @return a map with the env variables for the system
 */
private static Map<String, String> getDefaultSystemEnv(DebugPlugin defaultPlugin, IPythonNature nature)
        throws CoreException {
    ILaunchManager launchManager = defaultPlugin.getLaunchManager();

    // build base environment
    Map<String, String> env = new HashMap<String, String>();
    env.putAll(launchManager.getNativeEnvironment());

    // Add variables from config
    boolean win32 = PlatformUtils.isWindowsPlatform();
    for (Iterator<Map.Entry<String, String>> iter = env.entrySet().iterator(); iter.hasNext();) {
        Entry<String, String> entry = iter.next();
        String key = entry.getKey();
        if (win32) {
            // Win32 vars are case insensitive. Uppercase everything so
            // that (for example) "pAtH" will correctly replace "PATH"
            key = key.toUpperCase();
        }
        String value = entry.getValue();
        // translate any string substitution variables
        String translated = value;
        if (nature != null) {
            try {
                StringSubstitution stringSubstitution = new StringSubstitution(nature);
                translated = stringSubstitution.performStringSubstitution(value, false);
            } catch (Exception e) {
                Log.log(e);
            }
        }
        env.put(key, translated);
    }

    //Always remove PYTHONHOME from the default system env, as it doesn't work well with multiple interpreters.
    env.remove("PYTHONHOME");
    // PyDev-495 Remove VIRTUAL_ENV as it cause IPython to munge the PYTHON_PATH
    env.remove("VIRTUAL_ENV");
    return env;
}
 
Example 2
Source File: BaseDebugView.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
    IViewSite viewSite = getViewSite();
    if (viewSite != null) {
        configureToolBar(viewSite);
    }

    parent.setLayout(new GridLayout(1, true));

    viewer = new TreeViewer(parent);
    provider = createContentProvider();
    viewer.setContentProvider(provider);
    viewer.setLabelProvider(new PyDebugModelPresentation(false));

    GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getTree());

    MenuManager menuManager = new MenuManager();
    Menu menu = menuManager.createContextMenu(viewer.getTree());
    viewer.getTree().setMenu(menu);
    IWorkbenchPartSite site = getSite();
    site.registerContextMenu(menuManager, viewer);
    site.setSelectionProvider(viewer);

    this.parent = parent;

    listener = createListener();
    if (listener != null) {
        DebugPlugin plugin = DebugPlugin.getDefault();

        ILaunchManager launchManager = plugin.getLaunchManager();
        launchManager.addLaunchListener(listener);

        plugin.addDebugEventListener(listener);
    }
}
 
Example 3
Source File: BaseDebugView.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void dispose() {
    super.dispose();
    if (listener != null) {
        DebugPlugin plugin = DebugPlugin.getDefault();

        ILaunchManager launchManager = plugin.getLaunchManager();
        launchManager.removeLaunchListener(listener);

        plugin.removeDebugEventListener(listener);
    }
    this.clear();
}