[英]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.