Changeset 3626 for devel-tools


Ignore:
Timestamp:
Mar 30, 2008, 9:09:28 PM (13 years ago)
Author:
yura
Message:
  • Stop in Refal Main function.
Location:
devel-tools/trunk/eclipse/org.refal.rfpdt.core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/plugin.xml

    r3622 r3626  
    3131         point="org.eclipse.debug.core.launchConfigurationTypes">
    3232      <launchConfigurationType
    33             delegate="org.eclipse.jdt.launching.JavaLaunchDelegate"
     33            delegate="org.refal.rfpdt.launching.RfpLaunchConfigurationDelegate"
    3434            id="org.refal.rfpdt.launching.rfpApplication"
    3535            modes="run, debug"
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/launching/RfpLaunchConfigurationDelegate.java

    r3625 r3626  
    1 package org.refal.plus.rfpdt.launch;
     1package org.refal.rfpdt.launching;
    22
     3import java.util.HashMap;
     4
     5import org.eclipse.core.resources.ResourcesPlugin;
    36import org.eclipse.core.runtime.CoreException;
    4 import org.eclipse.core.runtime.IProgressMonitor;
     7import org.eclipse.debug.core.DebugEvent;
    58import org.eclipse.debug.core.DebugPlugin;
     9import org.eclipse.debug.core.ILaunch;
    610import org.eclipse.debug.core.ILaunchConfiguration;
    7 import org.eclipse.debug.core.ILaunchManager;
    8 import org.eclipse.debug.core.IStatusHandler;
    9 import org.eclipse.debug.core.model.IBreakpoint;
     11import org.eclipse.jdt.debug.core.IJavaDebugTarget;
     12import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
     13import org.eclipse.jdt.debug.core.JDIDebugModel;
    1014import org.eclipse.jdt.launching.JavaLaunchDelegate;
     15import org.refal.rfpdt.core.RfpCore;
    1116
    1217public class RfpLaunchConfigurationDelegate extends JavaLaunchDelegate {
    1318    /**
    14      * Implementation from LaunchConfigurationDelegate (avoiding java-specific checks from JavaLaunchDelegate).
     19     * Handles the "stop-in-Main" option.
    1520     */
    16     public boolean preLaunchCheck (ILaunchConfiguration configuration, String mode, IProgressMonitor monitor)
    17             throws CoreException {
    18         if (!saveBeforeLaunch(configuration, mode, monitor)) {
    19             return false;
    20         }
    21         if (mode.equals(ILaunchManager.RUN_MODE) && configuration.supportsMode(ILaunchManager.DEBUG_MODE)) {
    22             IBreakpoint[] breakpoints = getBreakpoints(configuration);
    23             if (breakpoints == null) {
    24                 return true;
    25             }
    26             for (int i = 0; i < breakpoints.length; i++) {
    27                 if (breakpoints[i].isEnabled()) {
    28                     IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
    29                     if (prompter != null) {
    30                         boolean launchInDebugModeInstead = ((Boolean) prompter.handleStatus(switchToDebugPromptStatus,
    31                                 configuration)).booleanValue();
    32                         if (launchInDebugModeInstead) {
    33                             return false; // kill this launch
     21    public void handleDebugEvents (DebugEvent[] events) {
     22        for (int i = 0; i < events.length; i++) {
     23            DebugEvent event = events[i];
     24            if (event.getKind() == DebugEvent.CREATE && event.getSource() instanceof IJavaDebugTarget) {
     25                IJavaDebugTarget target = (IJavaDebugTarget) event.getSource();
     26                ILaunch launch = target.getLaunch();
     27                if (launch != null) {
     28                    ILaunchConfiguration configuration = launch.getLaunchConfiguration();
     29                    if (configuration != null) {
     30                        try {
     31                            if (isStopInMain(configuration)) {
     32                                String mainType = getMainTypeName(configuration);
     33                                if (mainType != null) {
     34                                    IJavaMethodBreakpoint bp = JDIDebugModel.createMethodBreakpoint(ResourcesPlugin
     35                                            .getWorkspace().getRoot(), mainType, "Main", "(Lorg/refal/plus/Result;)V",
     36                                            true, false, false, -1, -1, -1, 1, false, new HashMap<Object, Object>(10));
     37                                    bp.setPersisted(false);
     38                                    target.breakpointAdded(bp);
     39                                    DebugPlugin.getDefault().removeDebugEventListener(this);
     40                                }
     41                            }
     42                        } catch (CoreException e) {
     43                            RfpCore.log(e);
    3444                        }
    3545                    }
    36                     // if no user prompt, or user says to continue (no need to check other breakpoints)
    37                     return true;
    3846                }
    3947            }
    4048        }
    41         // no enabled breakpoints... continue launch
    42         return true;
    4349    }
    4450}
Note: See TracChangeset for help on using the changeset viewer.