繁体   English   中英

Eclipse插件:如何在“调试”视图中激活终止按钮

[英]Eclipse plug-in: how to activate terminate button in Debug view

我正在编写一个插件来扩展Eclipse以使用自定义编程语言。 我已经完成所有启动配置,并且使用自定义语言的任何程序都可以正确启动,但是似乎无法激活“调试”视图中的“终止”按钮。

根据我的研究,我知道实现Debugger框架可以提供Terminate操作,但是我不想在此阶段实现该框架,而是希望选择终止程序,而不必通过任务管理器。 那有可能吗? 还是调试器框架是执行此操作的唯一方法?

这是LaunchConfigurationDelegate类的代码,

public void launch(ILaunchConfiguration configuration, String mode,
        ILaunch launch, IProgressMonitor monitor) throws CoreException {

    // getting the resource from the workspace
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceRoot root = workspace.getRoot();

    List<String> filenames = configuration.getAttribute(RELATIVE_PATH,
            Collections.EMPTY_LIST);
    List<String> rawPaths = configuration.getAttribute(RAW_PATH,
            Collections.EMPTY_LIST);
    List<String> projPaths = configuration.getAttribute(PROJECT_PATH,
            Collections.EMPTY_LIST);

    //CustomRunner is the interface to manage the custom language execution
    CustomRunner runner = null;
    try {
        CustomOutputHandler outHand = new CustomOutputHandler();
        runner = new CustomRunner(new File(projPaths.get(0)));
        runner.setOutputHandler(outHand);

        for (int i = 0; i < filenames.size(); i++) {
            IPath temp = new Path(filenames.get(i));
            IResource CustomFile = root.findMember(temp);

            if (CustomFile == null) {
                String msg = "The file "
                        + "<"
                        + temp.toString()
                        + ">"
                        + " could not be found in the workspace.\nIt may have been deleted or renamed.";
                throw new FileNotFoundException(msg);
            }
            CustomFile.deleteMarkers(IMarker.PROBLEM, false,
                    IResource.DEPTH_INFINITE);
            CustomErrorHandler errHand = new CustomErrorHandler(CustomFile);

            runner.setErrorHandler(errHand);

            //Runs the custom language file
            runner.run(rawPaths.get(i));
        }

之后,只有一堆捕获块。

现在,我需要能够通过“调试”视图终止启动,而在“运行”模式下,可以通过“运行”菜单的终止命令终止启动。

我目前在此阶段没有任何DebugTarget。 我的问题是:是否有另一种方法可以在不扩展调试框架的情况下终止启动?

我确实尝试了这种启动方法中的launch.Terminate(),但是没有用。

除非您扩展Platform-debug支持,否则您将无法进入“调试”视图中的“终止”按钮-至少没有用于此的API。 您可以侵入调试框架的内部以添加支持而无需扩展,但是扩展可能比这容易得多,并且可以在将来的Eclipse版本中使用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM