private ILaunchConfiguration getRunningLaunchConfiguration() { Set<IProject> projects = new HashSet<IProject>( Arrays.asList(ProjectUtil.getProjects(repository))); ILaunchManager launchManager = DebugPlugin.getDefault() .getLaunchManager(); ILaunch[] launches = launchManager.getLaunches(); for (ILaunch launch : launches) { if (launch.isTerminated()) continue; ISourceLocator locator = launch.getSourceLocator(); if (locator instanceof ISourceLookupDirector) { ISourceLookupDirector director = (ISourceLookupDirector) locator; ISourceContainer[] containers = director.getSourceContainers(); if (isAnyProjectInSourceContainers(containers, projects)) return launch.getLaunchConfiguration(); } } return null; }
private ISourceLookupDirector read(ILaunchConfiguration config) throws CoreException { String memento = config.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null); if (memento == null) { return null; } String type = config.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String)null); if (type == null) { type = config.getType().getSourceLocatorId(); } ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ISourceLocator locator = launchManager.newSourceLocator(type); if (locator instanceof IPersistableSourceLocator2 == false) { return null; } ISourceLookupDirector director = (ISourceLookupDirector) locator; director.initializeFromMemento(memento, config); return director; }
@Override protected GdbLaunchDelegateExtension createGdbLaunchDelegate() { return new GdbLaunchDelegateExtension() { @Override protected GdbLaunch createGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator) throws CoreException { return doCreateGdbLaunch(configuration, mode, locator); } @Override protected LangDebugServicesExtensions createServicesExtensions( IDsfDebugServicesFactory parentServiceFactory) { return new GoDebugServicesExtensions(parentServiceFactory); }; }; }
/** * @param label * @param classToLaunch * @param classpath * @param bootClasspath * @param vmArgs * @param prgArgs * @param workDir * @param sourceLocator * @param debug * @param showInDebugger * @throws CoreException */ public void runVM(final String label, final String classToLaunch, final String[] classpath, final String[] bootClasspath, final String[] vmArgs, final String[] prgArgs, final String workDir, final ISourceLocator sourceLocator, final boolean debug, final boolean showInDebugger) throws CoreException { final IVMInstall vmInstall = this.getVMInstall(); String mode = ILaunchManager.DEBUG_MODE; if (debug && classToLaunch.equals(WEBLOGIC_MAIN_CLASS)) { mode = ILaunchManager.DEBUG_MODE; } else { mode = ILaunchManager.RUN_MODE; } final IVMRunner vmRunner = vmInstall.getVMRunner(mode); final ILaunchConfigurationType launchType = DebugPlugin.getDefault().getLaunchManager() .getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); final ILaunchConfigurationWorkingCopy config = launchType.newInstance(null, label); config.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true); config.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"); DebugUITools.setLaunchPerspective(launchType, mode, IDebugUIConstants.PERSPECTIVE_DEFAULT); final Launch launch = new Launch(config, mode, sourceLocator); config.doSave(); if (vmRunner != null) { final VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(classToLaunch, classpath); vmConfig.setVMArguments(vmArgs); vmConfig.setProgramArguments(prgArgs); if (workDir != null) { vmConfig.setWorkingDirectory(workDir); } if (bootClasspath.length == 0) { vmConfig.setBootClassPath(null); } else { vmConfig.setBootClassPath(bootClasspath); } vmRunner.run(vmConfig, launch, null); } if (showInDebugger) { DebugPlugin.getDefault().getLaunchManager().addLaunch(launch); } }
public void handleDebugEvents(DebugEvent[] events) { if(events.length > 0 && runtime != null && !runtime.isTerminated()) { DebugEvent e = events[0]; PandionJUI.executeUpdate(() -> { if(e.getKind() == DebugEvent.SUSPEND && e.getDetail() == DebugEvent.STEP_END && exception == null) { IJavaThread thread = (IJavaThread) e.getSource(); IStackFrame f = thread.getTopStackFrame(); if(f == null) return; ISourceLocator sourceLocator = f.getLaunch().getSourceLocator(); Object sourceElement = sourceLocator == null ? null : sourceLocator.getSourceElement(f); if(sourceElement != null) { if(sourceElement instanceof IFile) handleFrames(thread); else thread.stepReturn(); if(f != null && f.getLineNumber() == -1) thread.resume(); // to jump over injected code } else { thread.stepReturn(); } // Job job = Job.create("Update table", (ICoreRunnable) monitor -> { // System.out.println("STEP"); // thread.stepInto(); // }); // job.schedule(3000); } else if(e.getKind() == DebugEvent.CHANGE && e.getDetail() == DebugEvent.CONTENT) { runtime = new RuntimeModel(); runtimeView.setInput(runtime); } else if(e.getKind() == DebugEvent.TERMINATE && e.getSource() instanceof RuntimeProcess) { runtime.setTerminated(); } }); } }
@Override public ISourceLocator getSourceLocator() { return sourceLocator; }
@Override public void setSourceLocator(ISourceLocator locator) { sourceLocator = locator; }
public TestLaunch( ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator ) { super( launchConfiguration, mode, locator ); }
public ISourceLocator getSourceLocator() { return null; }
public void setSourceLocator(ISourceLocator sourceLocator) { }
@Override protected ISourceLocator getSourceLocator(ILaunchConfiguration configuration, DsfSession session) throws CoreException { return super.getSourceLocator(configuration, session); }
@Override protected GdbLaunch createGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator) throws CoreException { return doCreateGdbLaunch(configuration, mode, locator); }
protected abstract GdbLaunch doCreateGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator);
@Override protected GdbLaunch doCreateGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator) { return new GoGdbLaunch(configuration, mode, locator); }
protected GoGdbLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) { super(launchConfiguration, mode, locator); }
public SimulationLaunch(final ILaunchConfiguration launchConfiguration, final String mode, final ISourceLocator locator) { super(launchConfiguration, mode, locator); }