use of org.jkiss.dbeaver.ui.ISearchContextProvider in project dbeaver by serge-rider.
the class EntityEditorContributor method registerSearchActions.
public static void registerSearchActions(IEditorPart activeEditor) {
if (activeEditor == null) {
return;
}
IActionBars actionBars = activeEditor.getEditorSite().getActionBars();
if (activeEditor instanceof ISearchContextProvider) {
ISearchContextProvider provider = (ISearchContextProvider) activeEditor;
if (provider.isSearchPossible()) {
ContextSearchAction findAction = new ContextSearchAction(provider, ISearchContextProvider.SearchType.NONE);
findAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
actionBars.setGlobalActionHandler(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE, findAction);
ContextSearchAction findNextAction = new ContextSearchAction(provider, ISearchContextProvider.SearchType.NEXT);
findNextAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_NEXT);
actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.FIND_NEXT, findNextAction);
ContextSearchAction findPrevAction = new ContextSearchAction(provider, ISearchContextProvider.SearchType.PREVIOUS);
findPrevAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_PREVIOUS);
actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.FIND_PREVIOUS, findPrevAction);
}
} else {
actionBars.setGlobalActionHandler(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE, null);
actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.FIND_NEXT, null);
actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.FIND_PREVIOUS, null);
}
actionBars.updateActionBars();
}
Aggregations