use of org.jkiss.dbeaver.model.app.DBPWorkspace in project dbeaver by serge-rider.
the class DataSourceRegistry method getAllDataSources.
public static List<DBPDataSourceContainer> getAllDataSources() {
List<DBPDataSourceContainer> result = new ArrayList<>();
DBPWorkspace workspace = DBWorkbench.getPlatform().getWorkspace();
for (DBPProject project : workspace.getProjects()) {
if (project.isOpen() && project.isRegistryLoaded()) {
result.addAll(project.getDataSourceRegistry().getDataSources());
}
}
return result;
}
use of org.jkiss.dbeaver.model.app.DBPWorkspace in project dbeaver by dbeaver.
the class NavigatorHandlerProjectSetActive method setActiveProject.
static void setActiveProject(DBPProject project) {
DBPWorkspace workspace = DBWorkbench.getPlatform().getWorkspace();
if (workspace.getActiveProject() != project) {
workspace.setActiveProject(project);
GlobalPropertyTester.firePropertyChange(GlobalPropertyTester.PROP_HAS_ACTIVE_PROJECT);
}
}
use of org.jkiss.dbeaver.model.app.DBPWorkspace in project dbeaver by dbeaver.
the class ResourcePropertyTester method test.
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (!(receiver instanceof IResource)) {
return false;
}
IResource resource = (IResource) receiver;
DBPWorkspace workspace = DBWorkbench.getPlatform().getWorkspace();
DBPResourceHandler handler = workspace.getResourceHandler(resource);
if (handler == null) {
return false;
}
switch(property) {
case PROP_CAN_OPEN:
return (handler.getFeatures(resource) & DBPResourceHandler.FEATURE_OPEN) != 0;
case PROP_CAN_DELETE:
return (handler.getFeatures(resource) & DBPResourceHandler.FEATURE_DELETE) != 0;
case PROP_CAN_CREATE_FILE:
return handler instanceof DBPResourceCreator && (handler.getFeatures(resource) & DBPResourceCreator.FEATURE_CREATE_FILE) != 0;
case PROP_CAN_CREATE_FOLDER:
return (handler.getFeatures(resource) & DBPResourceHandler.FEATURE_CREATE_FOLDER) != 0;
case PROP_CAN_CREATE_LINK:
return (handler.getFeatures(resource) & DBPResourceHandler.FEATURE_CREATE_FOLDER) != 0 && !resource.isLinked(IResource.CHECK_ANCESTORS);
case PROP_CAN_SET_ACTIVE:
{
DBPProject activeProject = workspace.getActiveProject();
return resource instanceof IProject && (activeProject == null || resource != activeProject.getEclipseProject());
}
case PROP_TYPE:
final DBPResourceHandler resourceHandler = DBWorkbench.getPlatform().getWorkspace().getResourceHandler(resource);
return resourceHandler != null && expectedValue.equals(resourceHandler.getTypeName(resource));
}
return false;
}
Aggregations