Search in sources :

Example 31 with DBPDataSourceContainer

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

the class DBXTreeFolder method getChildren.

@NotNull
@Override
public List<DBXTreeNode> getChildren(DBNNode context) {
    List<DBXTreeNode> children = super.getChildren(context);
    if (!CommonUtils.isEmpty(contributedCategories) && context instanceof DBNDatabaseNode) {
        // Add contributed editors
        List<DBXTreeNode> childrenWithContributions = new ArrayList<>(children);
        DBPDataSourceProviderRegistry dspRegistry = DBWorkbench.getPlatform().getDataSourceProviderRegistry();
        DBPDataSourceContainer dataSource = ((DBNDatabaseNode) context).getDataSourceContainer();
        for (String category : contributedCategories) {
            DBPEditorContribution[] editors = dspRegistry.getContributedEditors(category, dataSource);
            for (DBPEditorContribution editor : editors) {
                DBXTreeObject editorNode = new DBXTreeObject(getSource(), // No parent - otherwise we'll have dups after each call
                null, null, null, editor.getLabel(), editor.getDescription(), editor.getEditorId());
                editorNode.setDefaultIcon(editor.getIcon());
                childrenWithContributions.add(editorNode);
            }
        }
        return childrenWithContributions;
    }
    return children;
}
Also used : DBPDataSourceProviderRegistry(org.jkiss.dbeaver.model.connection.DBPDataSourceProviderRegistry) DBPEditorContribution(org.jkiss.dbeaver.model.connection.DBPEditorContribution) ArrayList(java.util.ArrayList) DBNDatabaseNode(org.jkiss.dbeaver.model.navigator.DBNDatabaseNode) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) NotNull(org.jkiss.code.NotNull)

Example 32 with DBPDataSourceContainer

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

the class NativeToolConfigPanel method updateHomeSelector.

private void updateHomeSelector() {
    DBPDataSourceContainer newDataSource = null;
    if (selectedObject instanceof DBPDataSourceContainer) {
        newDataSource = (DBPDataSourceContainer) selectedObject;
    } else if (selectedObject != null) {
        newDataSource = selectedObject.getDataSource().getContainer();
    }
    if (newDataSource != null && curDataSource != newDataSource) {
        homesSelector.populateHomes(newDataSource.getDriver(), newDataSource.getConnectionConfiguration().getClientHomeId(), true);
    }
    curDataSource = newDataSource;
}
Also used : DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer)

Example 33 with DBPDataSourceContainer

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

the class NativeToolWizardDialog method openClientConfiguration.

private void openClientConfiguration() {
    AbstractNativeToolWizard toolWizard = (AbstractNativeToolWizard) getWizard();
    DBPDataSourceContainer dataSource = toolWizard.getSettings().getDataSourceContainer();
    if (dataSource != null) {
        NativeClientConfigDialog dialog = new NativeClientConfigDialog(getShell(), dataSource);
        if (dialog.open() == IDialogConstants.OK_ID) {
            toolWizard.updateErrorMessage();
            updateButtons();
        }
    }
}
Also used : DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer)

Example 34 with DBPDataSourceContainer

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

the class SQLEditorHandlerSeparateConnectionOption method updateElement.

@Override
public void updateElement(UIElement element, Map parameters) {
    element.setText(SQLEditorMessages.pref_page_sql_editor_label_separate_connection_each_editor);
    element.setTooltip(SQLEditorMessages.pref_page_sql_editor_label_separate_connection_each_editor);
    IEditorPart activeEditor = UIUtils.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    DBPDataSourceContainer dsContainer = activeEditor == null ? null : getDataSourceContainerFromPart(activeEditor);
    DBPPreferenceStore prefStore = dsContainer == null ? DBWorkbench.getPlatform().getPreferenceStore() : dsContainer.getPreferenceStore();
    element.setChecked(prefStore.getBoolean(SQLPreferenceConstants.EDITOR_SEPARATE_CONNECTION));
}
Also used : IEditorPart(org.eclipse.ui.IEditorPart) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 35 with DBPDataSourceContainer

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

the class DBGSourcePathComputer method computeSourceContainers.

@Override
public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
    DBPDataSourceContainer dataSource = DebugUtils.getDataSourceContainer(configuration);
    DatabaseNavigatorSourceContainer container = new DatabaseNavigatorSourceContainer(dataSource);
    return new ISourceContainer[] { container };
}
Also used : ISourceContainer(org.eclipse.debug.core.sourcelookup.ISourceContainer) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer)

Aggregations

DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)148 IFile (org.eclipse.core.resources.IFile)22 ArrayList (java.util.ArrayList)21 DBException (org.jkiss.dbeaver.DBException)19 DBCExecutionContext (org.jkiss.dbeaver.model.exec.DBCExecutionContext)19 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)19 DBPDataSource (org.jkiss.dbeaver.model.DBPDataSource)14 DBNDataSource (org.jkiss.dbeaver.model.navigator.DBNDataSource)14 InvocationTargetException (java.lang.reflect.InvocationTargetException)13 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)13 DBPConnectionConfiguration (org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)12 DBNDatabaseNode (org.jkiss.dbeaver.model.navigator.DBNDatabaseNode)12 IFolder (org.eclipse.core.resources.IFolder)11 IEditorPart (org.eclipse.ui.IEditorPart)11 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)10 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 DBNNode (org.jkiss.dbeaver.model.navigator.DBNNode)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 GridData (org.eclipse.swt.layout.GridData)9 IDataSourceContainerProvider (org.jkiss.dbeaver.model.IDataSourceContainerProvider)9