提交 b6d090c0 编写于 作者: J jurgen

Find/replace fix (DDE action handler)

Former-commit-id: b4984e93
上级 4f25dc5e
......@@ -226,4 +226,10 @@ class ResultSetFindReplaceTarget implements IFindReplaceTarget, IFindReplaceTarg
{
}
@Override
public String toString()
{
return "Target: " + resultSet.getDataContainer().getName();
}
}
......@@ -53,8 +53,6 @@ import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.menus.CommandContributionItem;
import org.eclipse.ui.progress.UIJob;
import org.eclipse.ui.texteditor.FindReplaceAction;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.themes.ITheme;
import org.eclipse.ui.themes.IThemeManager;
import org.eclipse.ui.views.properties.IPropertySheetPage;
......@@ -62,7 +60,6 @@ import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.IPropertySourceProvider;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.core.CoreMessages;
import org.jkiss.dbeaver.core.DBeaverActivator;
import org.jkiss.dbeaver.core.DBeaverCore;
import org.jkiss.dbeaver.core.DBeaverUI;
import org.jkiss.dbeaver.ext.IDataSourceProvider;
......@@ -640,7 +637,8 @@ public class ResultSetViewer extends Viewer implements IDataSourceProvider, ISpr
*/
toolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
//toolBarManager.add(viewMessageAction);
// handle own commands
toolBarManager.add(ActionUtils.makeCommandContribution(site, ResultSetCommandHandler.CMD_APPLY_CHANGES));
toolBarManager.add(ActionUtils.makeCommandContribution(site, ResultSetCommandHandler.CMD_REJECT_CHANGES));
toolBarManager.add(new Separator());
......@@ -654,15 +652,11 @@ public class ResultSetViewer extends Viewer implements IDataSourceProvider, ISpr
toolBarManager.add(ActionUtils.makeCommandContribution(site, ResultSetCommandHandler.CMD_ROW_NEXT));
toolBarManager.add(ActionUtils.makeCommandContribution(site, ResultSetCommandHandler.CMD_ROW_LAST));
toolBarManager.add(new Separator());
//toolBarManager.add(ActionUtils.makeCommandContribution(site, IWorkbenchCommandConstants.FILE_REFRESH, "Refresh result set", DBIcon.RS_REFRESH.getImageDescriptor()));
// Use simple action for refresh to avoid ambiguous behaviour of F5 shortcut
//toolBarManager.add(ActionUtils.makeCommandContribution(site, IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE, CommandContributionItem.STYLE_PUSH, DBIcon.FIND_TEXT.getImageDescriptor()));
FindReplaceAction findReplaceAction = new FindReplaceAction(DBeaverActivator.getResourceBundle(), "Editor.FindReplace.", site.getPart()); //$NON-NLS-1$
findReplaceAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
findReplaceAction.setImageDescriptor(DBIcon.FIND_TEXT.getImageDescriptor());
toolBarManager.add(findReplaceAction);
// Link to standard Find/Replace action - it has to be handled by owner site
toolBarManager.add(ActionUtils.makeCommandContribution(site, IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE, CommandContributionItem.STYLE_PUSH, DBIcon.FIND_TEXT.getImageDescriptor()));
// Use simple action for refresh to avoid ambiguous behaviour of F5 shortcut
//toolBarManager.add(ActionUtils.makeCommandContribution(site, IWorkbenchCommandConstants.FILE_REFRESH, "Refresh result set", DBIcon.RS_REFRESH.getImageDescriptor()));
Action refreshAction = new Action(CoreMessages.controls_resultset_viewer_action_refresh, DBIcon.RS_REFRESH.getImageDescriptor()) {
@Override
public void run()
......
......@@ -61,13 +61,6 @@ public class DatabaseDataEditor extends AbstractDatabaseObjectEditor<DBSDataCont
// Set selection provider from resultset
getSite().setSelectionProvider(resultSetView);
// FindReplaceAction findReplaceAction = new FindReplaceAction(DBeaverActivator.getResourceBundle(), "Editor.FindReplace.", this); //$NON-NLS-1$
// findReplaceAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
//
// IActionBars actionBars = getEditorSite().getActionBars();
// actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), findReplaceAction);
// actionBars.updateActionBars();
}
// FindReplaceAction action = (FindReplaceAction)getEditorSite().getActionBars().getGlobalActionHandler(ActionFactory.FIND.getId());
......@@ -123,6 +116,16 @@ public class DatabaseDataEditor extends AbstractDatabaseObjectEditor<DBSDataCont
if (resultSetView != null) {
resultSetView.getSpreadsheet().setFocus();
}
// Register find/replace action
// We do it in setFocus because each entity editor registers it's own action - and they
// share a single action bars instance. To avoid mess just update handler every time editor activated
FindReplaceAction findReplaceAction = new FindReplaceAction(DBeaverActivator.getResourceBundle(), "Editor.FindReplace.", this); //$NON-NLS-1$
findReplaceAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
IActionBars actionBars = getEditorSite().getActionBars();
actionBars.setGlobalActionHandler("dde_findReplace", findReplaceAction);
actionBars.updateActionBars();
}
@Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册