提交 6bcafe1a 编写于 作者: S Serge Rider

SQL editor command context fix

上级 8b1d093f
......@@ -31,8 +31,6 @@ import org.jkiss.dbeaver.ui.ActionUtils;
import org.jkiss.dbeaver.ui.DBeaverUIConstants;
import org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer;
import org.jkiss.dbeaver.ui.editors.entity.EntityEditor;
import org.jkiss.dbeaver.ui.editors.sql.SQLEditorBase;
import org.jkiss.dbeaver.ui.navigator.INavigatorModelView;
/**
* WorkbenchContextListener.
......@@ -44,11 +42,9 @@ class WorkbenchContextListener implements IWindowListener, IPageListener, IPartL
//private static final Log log = Log.getLog(WorkbenchContextListener.class);
public static final String SQL_EDITOR_CONTEXT_ID = "org.jkiss.dbeaver.ui.editors.sql";
public static final String RESULTS_CONTEXT_ID = "org.jkiss.dbeaver.ui.context.resultset";
public static final String PERSPECTIVE_CONTEXT_ID = "org.jkiss.dbeaver.ui.perspective";
private static final String RESULTS_CONTEXT_ID = "org.jkiss.dbeaver.ui.context.resultset";
private static final String PERSPECTIVE_CONTEXT_ID = "org.jkiss.dbeaver.ui.perspective";
private IContextActivation activationSQL;
private IContextActivation activationResults;
private CommandExecutionListener commandExecutionListener;
......@@ -171,13 +167,6 @@ class WorkbenchContextListener implements IWindowListener, IPageListener, IPartL
}
try {
contextService.deferUpdates(true);
if (part.getAdapter(SQLEditorBase.class) != null) {
if (activationSQL != null) {
//log.debug("Double activation of SQL context");
contextService.deactivateContext(activationSQL);
}
activationSQL = contextService.activateContext(SQL_EDITOR_CONTEXT_ID);
}
if (part.getAdapter(ResultSetViewer.class) != null || (
part instanceof EntityEditor && ((EntityEditor) part).getDatabaseObject() instanceof DBSDataContainer))
{
......@@ -207,10 +196,6 @@ class WorkbenchContextListener implements IWindowListener, IPageListener, IPartL
}
try {
contextService.deferUpdates(true);
if (activationSQL != null && part instanceof SQLEditorBase) {
contextService.deactivateContext(activationSQL);
activationSQL = null;
}
if (activationResults != null) {
contextService.deactivateContext(activationResults);
activationResults = null;
......
......@@ -29,16 +29,11 @@ import org.eclipse.jface.text.source.projection.ProjectionViewer;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.contexts.IContextActivation;
import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.texteditor.*;
......@@ -86,8 +81,6 @@ public abstract class SQLEditorBase extends BaseTextEditor implements IErrorVisu
static protected final Log log = Log.getLog(SQLEditorBase.class);
public static final String SQL_CONTROL_CONTEXT_ID = "org.jkiss.dbeaver.ui.editors.sql.script.focused";
static {
// SQL editor preferences. Do this here because it initializes display
// (that's why we can't run it in prefs initializer classes which run before workbench creation)
......@@ -251,7 +244,7 @@ public abstract class SQLEditorBase extends BaseTextEditor implements IErrorVisu
{
// Context listener
EditorUtils.trackControlContext(getSite(), getViewer().getTextWidget(), SQL_CONTROL_CONTEXT_ID);
EditorUtils.trackControlContext(getSite(), getViewer().getTextWidget(), SQLEditorContributions.SQL_EDITOR_CONTROL_CONTEXT);
}
}
......
......@@ -20,6 +20,7 @@ public class SQLEditorContributions {
public static final String SQL_EDITOR_CONTEXT = "org.jkiss.dbeaver.ui.editors.sql"; //$NON-NLS-1$
public static final String SQL_EDITOR_SCRIPT_CONTEXT = "org.jkiss.dbeaver.ui.editors.sql.script"; //$NON-NLS-1$
public static final String SQL_EDITOR_CONTROL_CONTEXT = "org.jkiss.dbeaver.ui.editors.sql.script.focused";
public static final String SQL_EDITOR_CONTEXT_MENU_ID = "#SQLEditorContext"; //$NON-NLS-1$
public static final String SQL_RULER_CONTEXT_MENU_ID = "#SQLRulerContext"; //$NON-NLS-1$
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册