0

When I try to finish a activity listener plugin project in Eclipse, I get null returned by DebugPlugin.getDefault() in my project, the code like below:

public class SampleHandler extends AbstractHandler {

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
//      System.out.println("hello1");
    BreakpointListener bl = new BreakpointListener();
    DebugEventSetListener desl = new DebugEventSetListener();
//      System.out.println("hello2");
    System.out.println(bl.toString());

    System.out.println(DebugPlugin.getDefault());//print null 

    System.out.println(DebugPlugin.getDefault().getBreakpointManager());
   DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(bl);
    DebugPlugin.getDefault().addDebugEventListener(desl);

    return null;
    }
}

I'm sure I have imported org.eclipse.debug.core, but DebugPlugin.getDefault() give me a null.

How can I solve this problem? Why this problem occured?

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • How are you running this code? Are you using Run as Eclipse Application to test your plugin? – greg-449 Feb 27 '18 at 08:15
  • @greg-449 yep, i just running it and it opens a new Eclipse platform. it never gives a error report before but when i click the plugin icon, it throws exception( java.lang.NullPointerException) – buaa0110 Mar 01 '18 at 00:58

0 Answers0