Search in sources :

Example 1 with ToggleBreakpointAction

use of org.eclipse.debug.ui.actions.ToggleBreakpointAction in project dbeaver by serge-rider.

the class ToggleBreakpointHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
    if (activeEditor != null) {
        SQLEditorBase sqlEditor = activeEditor.getAdapter(SQLEditorBase.class);
        if (sqlEditor != null) {
            ITextViewer textViewer = sqlEditor.getAdapter(ITextViewer.class);
            if (textViewer != null) {
                IVerticalRulerInfo rulerInfo = sqlEditor.getAdapter(IVerticalRulerInfo.class);
                ToggleBreakpointAction action = new ToggleBreakpointAction(sqlEditor, textViewer.getDocument(), rulerInfo);
                action.runWithEvent(new Event());
            }
        }
    }
    return null;
}
Also used : SQLEditorBase(org.jkiss.dbeaver.ui.editors.sql.SQLEditorBase) ExecutionEvent(org.eclipse.core.commands.ExecutionEvent) Event(org.eclipse.swt.widgets.Event) IEditorPart(org.eclipse.ui.IEditorPart) IVerticalRulerInfo(org.eclipse.jface.text.source.IVerticalRulerInfo) ToggleBreakpointAction(org.eclipse.debug.ui.actions.ToggleBreakpointAction) ITextViewer(org.eclipse.jface.text.ITextViewer)

Aggregations

ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)1 ToggleBreakpointAction (org.eclipse.debug.ui.actions.ToggleBreakpointAction)1 ITextViewer (org.eclipse.jface.text.ITextViewer)1 IVerticalRulerInfo (org.eclipse.jface.text.source.IVerticalRulerInfo)1 Event (org.eclipse.swt.widgets.Event)1 IEditorPart (org.eclipse.ui.IEditorPart)1 SQLEditorBase (org.jkiss.dbeaver.ui.editors.sql.SQLEditorBase)1