Search in sources :

Example 1 with DBPDataSourceProviderRegistry

use of org.jkiss.dbeaver.model.connection.DBPDataSourceProviderRegistry 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 2 with DBPDataSourceProviderRegistry

use of org.jkiss.dbeaver.model.connection.DBPDataSourceProviderRegistry in project dbeaver by dbeaver.

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)

Aggregations

ArrayList (java.util.ArrayList)2 NotNull (org.jkiss.code.NotNull)2 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)2 DBPDataSourceProviderRegistry (org.jkiss.dbeaver.model.connection.DBPDataSourceProviderRegistry)2 DBPEditorContribution (org.jkiss.dbeaver.model.connection.DBPEditorContribution)2 DBNDatabaseNode (org.jkiss.dbeaver.model.navigator.DBNDatabaseNode)2