在Eclipse RCP中的自定义编辑器上切换断点?
我想在我创建的新编辑器上切换断点。我已经实现并运行了一个新的编辑器和一个新的LineBreakpoint。我已经可以使用Ctrl+Shift+B或主菜单->运行->切换行断点来切换这些断点。我希望能够在Java编辑器中向自定义eclipse应用程序的垂直标尺栏添加完全相同的切换行为。也就是说,双击在给定的行位置创建/切换断点。右键单击将在垂直标尺栏上显示“切换断点”菜单上下文。完成与线切换图像标签太在Eclipse RCP中的自定义编辑器上切换断点?,eclipse,eclipse-rcp,eclipse-plugin,Eclipse,Eclipse Rcp,Eclipse Plugin,我想在我创建的新编辑器上切换断点。我已经实现并运行了一个新的编辑器和一个新的LineBreakpoint。我已经可以使用Ctrl+Shift+B或主菜单->运行->切换行断点来切换这些断点。我希望能够在Java编辑器中向自定义eclipse应用程序的垂直标尺栏添加完全相同的切换行为。也就是说,双击在给定的行位置创建/切换断点。右键单击将在垂直标尺栏上显示“切换断点”菜单上下文。完成与线切换图像标签太 我假设有一种简单的方法来实现这一点,而不是实现每个菜单和操作。如果没有,我如何将这些双击和上下文
我假设有一种简单的方法来实现这一点,而不是实现每个菜单和操作。如果没有,我如何将这些双击和上下文菜单添加到自定义编辑器的垂直标尺中?我正在考虑做同样的事情。到目前为止,我发现扩展AbstractDecoratedTextEditor将为您提供这样做的平台。当它工作时,我将进行更新。这是一个老问题,但我遇到了这个问题,并执行了以下操作: 我有一个编辑器org.eclipse.ui.texteditor.AbstractDecoratedTextEditor。在这个编辑器类上,我实现了这个方法:
@Override
protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) {
AnnotationRulerColumn column = new MyAnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess(), this);
return column;
}
MyAnnotationRulerColumn类是一些人认为的:
import org.eclipse.debug.ui.actions.ToggleBreakpointAction;
import org.eclipse.jface.text.source.AnnotationRulerColumn;
import org.eclipse.jface.text.source.IAnnotationAccess;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
public class MyAnnotationRulerColumn extends AnnotationRulerColumn {
private MyEditor editor;
public MyAnnotationRulerColumn(int width, IAnnotationAccess annotationAccess, MyEditor part) {
super(width, annotationAccess);
this.editor = part;
}
@Override
protected void mouseDoubleClicked(int rulerLine) {
if (editor != null) {
IVerticalRulerInfo rulerInfo= (IVerticalRulerInfo) editor.getAdapter(IVerticalRulerInfo.class);
ToggleBreakpointAction action = new ToggleBreakpointAction(editor, null, rulerInfo);
action.update();
action.run();
}
}
}