package tool.editors;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDEActionFactory;
import org.eclipse.ui.menus.IMenuService;
import org.eclipse.ui.texteditor.BasicTextEditorActionContributor;
import org.eclipse.ui.texteditor.ITextEditor;
public class ToolActionContributor extends BasicTextEditorActionContributor {
@Override
public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
if (!(part instanceof ITextEditor)) return;
IActionBars actionBars = getActionBars();
if (actionBars == null) return;
ITextEditor editor = (ITextEditor)part;
actionBars.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(),
getAction(editor, IDEActionFactory.ADD_TASK.getId()));
actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(),
getAction(editor, IDEActionFactory.BOOKMARK.getId()));
}
}