use of org.jkiss.dbeaver.tools.registry.ToolDescriptor in project dbeaver by dbeaver.
the class DataSourceToolsContributor method getAvailableTools.
private List<ToolDescriptor> getAvailableTools(IStructuredSelection selection) {
List<DBSObject> objects = NavigatorUtils.getSelectedObjects(selection);
List<ToolDescriptor> result = new ArrayList<>();
if (!objects.isEmpty()) {
for (ToolDescriptor descriptor : ToolsRegistry.getInstance().getTools()) {
if (descriptor.isSingleton() && objects.size() > 1) {
continue;
}
boolean applies = true;
for (DBSObject object : objects) {
if (!descriptor.appliesTo(object)) {
applies = false;
break;
}
}
if (applies) {
result.add(descriptor);
}
}
}
return result;
}
Aggregations