提交 f7a528b7 编写于 作者: S serge-rider

Navigator contexts activation fix


Former-commit-id: 8ff981c7
上级 d401491e
......@@ -50,7 +50,7 @@ class WorkbenchContextListener implements IWindowListener, IPageListener, IPartL
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 activationNavigator;
// private IContextActivation activationNavigator;
private IContextActivation activationSQL;
private IContextActivation activationResults;
private CommandExecutionListener commandExecutionListener;
......@@ -198,11 +198,11 @@ class WorkbenchContextListener implements IWindowListener, IPageListener, IPartL
if (part instanceof INavigatorModelView) {
// We check for instanceof (do not use adapter) because otherwise it become active
// for all entity editor and clashes with SQL editor and other complex stuff.
if (activationNavigator != null) {
//log.debug("Double activation of navigator context");
contextService.deactivateContext(activationNavigator);
}
activationNavigator = contextService.activateContext(INavigatorModelView.NAVIGATOR_CONTEXT_ID);
// if (activationNavigator != null) {
// //log.debug("Double activation of navigator context");
// contextService.deactivateContext(activationNavigator);
// }
// activationNavigator = contextService.activateContext(INavigatorModelView.NAVIGATOR_CONTEXT_ID);
}
if (part instanceof SQLEditorBase || part.getAdapter(SQLEditorBase.class) != null) {
if (activationSQL != null) {
......@@ -241,10 +241,10 @@ class WorkbenchContextListener implements IWindowListener, IPageListener, IPartL
}
try {
contextService.deferUpdates(true);
if (activationNavigator != null && part instanceof INavigatorModelView) {
contextService.deactivateContext(activationNavigator);
activationNavigator = null;
}
// if (activationNavigator != null && part instanceof INavigatorModelView) {
// contextService.deactivateContext(activationNavigator);
// activationNavigator = null;
// }
if (activationSQL != null) {
contextService.deactivateContext(activationSQL);
activationSQL = null;
......
......@@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.jkiss.code.NotNull;
......@@ -104,8 +105,10 @@ public abstract class NavigatorViewBase extends ViewPart implements INavigatorMo
this.tree = createNavigatorTree(parent, getRootNode());
getViewSite().setSelectionProvider(tree.getViewer());
EditorUtils.trackControlContext(getSite(), this.tree.getViewer().getControl(), INavigatorModelView.NAVIGATOR_CONTEXT_ID);
EditorUtils.trackControlContext(getSite(), this.tree.getViewer().getControl(), INavigatorModelView.NAVIGATOR_VIEW_CONTEXT_ID);
getSite().getService(IContextService.class).activateContext(INavigatorModelView.NAVIGATOR_CONTEXT_ID);
getSite().getService(IContextService.class).activateContext(INavigatorModelView.NAVIGATOR_VIEW_CONTEXT_ID);
// EditorUtils.trackControlContext(getSite(), this.tree.getViewer().getControl(), INavigatorModelView.NAVIGATOR_CONTEXT_ID);
// EditorUtils.trackControlContext(getSite(), this.tree.getViewer().getControl(), INavigatorModelView.NAVIGATOR_VIEW_CONTEXT_ID);
}
private DatabaseNavigatorTree createNavigatorTree(Composite parent, DBNNode rootNode)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册