blob: c1d93f732477d1cfd9144fe61e1ddb5ed4472ee0 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Willink Transformations and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* E.D.Willink - revised from IActionDelegaye to IHandler
*******************************************************************************/
package org.eclipse.ocl.examples.debug.vm.ui.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.debug.ui.actions.ToggleBreakpointAction;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.handlers.HandlerUtil;
public class VMToggleBreakpointHandler extends AbstractHandler
{
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (part == null) {
return null;
}
IVerticalRulerInfo rulerInfo = part.getAdapter(IVerticalRulerInfo.class);
if (rulerInfo == null) {
return null;
}
ToggleBreakpointAction toggleBreakpointAction = new ToggleBreakpointAction(part, null, rulerInfo);
toggleBreakpointAction.run();
return null;
}
}