Search in sources :

Example 11 with DBECommandContext

use of org.jkiss.dbeaver.model.edit.DBECommandContext in project dbeaver by serge-rider.

the class UndoChangesHandler method updateElement.

@Override
public void updateElement(UIElement element, Map parameters) {
    IWorkbenchWindow workbenchWindow = element.getServiceLocator().getService(IWorkbenchWindow.class);
    if (workbenchWindow == null || workbenchWindow.getActivePage() == null) {
        return;
    }
    final IEditorPart activeEditor = workbenchWindow.getActivePage().getActiveEditor();
    if (activeEditor instanceof EntityEditor) {
        final DBECommandContext commandContext = ((EntityEditor) activeEditor).getCommandContext();
        String text = "Undo";
        if (commandContext != null && commandContext.getUndoCommand() != null) {
            text += " " + commandContext.getUndoCommand().getTitle();
        }
        element.setText(text);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) DBECommandContext(org.jkiss.dbeaver.model.edit.DBECommandContext) EntityEditor(org.jkiss.dbeaver.ui.editors.entity.EntityEditor) IEditorPart(org.eclipse.ui.IEditorPart)

Aggregations

DBECommandContext (org.jkiss.dbeaver.model.edit.DBECommandContext)11 Point (org.eclipse.swt.graphics.Point)2 IEditorPart (org.eclipse.ui.IEditorPart)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)2 DBException (org.jkiss.dbeaver.DBException)2 DBECommand (org.jkiss.dbeaver.model.edit.DBECommand)2 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)2 EntityEditor (org.jkiss.dbeaver.ui.editors.entity.EntityEditor)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 DBCException (org.jkiss.dbeaver.model.exec.DBCException)1 DBECommandAdapter (org.jkiss.dbeaver.model.impl.edit.DBECommandAdapter)1 DBNDatabaseNode (org.jkiss.dbeaver.model.navigator.DBNDatabaseNode)1 DBNNode (org.jkiss.dbeaver.model.navigator.DBNNode)1 EntityEditorDescriptor (org.jkiss.dbeaver.registry.editor.EntityEditorDescriptor)1 EntityEditorsRegistry (org.jkiss.dbeaver.registry.editor.EntityEditorsRegistry)1 ITabbedFolderContainer (org.jkiss.dbeaver.ui.controls.folders.ITabbedFolderContainer)1