Search in sources :

Example 1 with DatabaseEditorInput

use of org.jkiss.dbeaver.ui.editors.DatabaseEditorInput in project dbeaver by dbeaver.

the class TabbedFolderPageProperties method detachPropertiesPanel.

private void detachPropertiesPanel() {
    boolean attached = isAttached();
    String title = attached ? "Detach properties to top panel" : "Move properties to tab";
    if (UIUtils.confirmAction(part.getSite().getShell(), title, title + " will require to reopen editor.\nAre you sure?")) {
        DBPPreferenceStore prefs = DBeaverCore.getGlobalPreferenceStore();
        prefs.setValue(DBeaverPreferences.ENTITY_EDITOR_DETACH_INFO, attached);
        IEditorPart editor;
        if (part.getSite() instanceof MultiPageEditorSite) {
            editor = ((MultiPageEditorSite) part.getSite()).getMultiPageEditor();
        } else {
            editor = (IEditorPart) part;
        }
        if (editor != null) {
            DBNDatabaseNode node = null;
            if (editor.getEditorInput() instanceof DatabaseEditorInput) {
                node = ((DatabaseEditorInput) editor.getEditorInput()).getNavigatorNode();
            }
            DBeaverUI.getActiveWorkbenchWindow().getActivePage().closeEditor(editor, false);
            if (node != null) {
                NavigatorHandlerObjectOpen.openEntityEditor(node, null, DBeaverUI.getActiveWorkbenchWindow());
            }
        }
    }
}
Also used : DatabaseEditorInput(org.jkiss.dbeaver.ui.editors.DatabaseEditorInput) IDatabaseEditorInput(org.jkiss.dbeaver.ui.editors.IDatabaseEditorInput) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore) MultiPageEditorSite(org.eclipse.ui.part.MultiPageEditorSite) DBNDatabaseNode(org.jkiss.dbeaver.model.navigator.DBNDatabaseNode)

Aggregations

MultiPageEditorSite (org.eclipse.ui.part.MultiPageEditorSite)1 DBNDatabaseNode (org.jkiss.dbeaver.model.navigator.DBNDatabaseNode)1 DBPPreferenceStore (org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)1 DatabaseEditorInput (org.jkiss.dbeaver.ui.editors.DatabaseEditorInput)1 IDatabaseEditorInput (org.jkiss.dbeaver.ui.editors.IDatabaseEditorInput)1