Java Code Examples for com.intellij.util.containers.JBIterable#size()

The following examples show how to use com.intellij.util.containers.JBIterable#size() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DbTableUtil.java    From Thinkphp5-Plugin with MIT License 6 votes vote down vote up
public static JBIterable<? extends DasTable> getTables(Project project) {

        JBIterable<DbDataSource> dataSources = DbUtil.getDataSources(project);
        if (dataSources.size() < 1) {
            return null;
        } else {
            DbDataSource work = null;
            for (DbDataSource db : dataSources) {
                if (db.getName().contains("work")) {
                    work = db;
                    break;
                }
            }
            if (work != null) {
                return DasUtil.getTables(work.getDelegate());
            } else {
                if (dataSources.get(0) == null) return null;
                DbDataSource dbDataSource = dataSources.get(0);
                if(dbDataSource==null)return null;
                return DasUtil.getTables(dbDataSource.getDelegate());
            }
        }
    }
 
Example 2
Source File: SimpleToolWindowPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
public List<AnAction> getActions(boolean originalProvider) {
  JBIterable<ActionToolbar> toolbars = UIUtil.uiTraverser(myToolbar).traverse().filter(ActionToolbar.class);
  if (toolbars.size() == 0) return Collections.emptyList();
  return toolbars.flatten(toolbar -> toolbar.getActions()).toList();
}