Search in sources :

Example 1 with Dependency

use of com.android.tools.idea.gradle.parser.Dependency in project android by JetBrains.

the class ModuleDependenciesTableModel method getFilter.

public RowFilter<ModuleDependenciesTableModel, Integer> getFilter() {
    return new RowFilter<ModuleDependenciesTableModel, Integer>() {

        @Override
        public boolean include(Entry<? extends ModuleDependenciesTableModel, ? extends Integer> entry) {
            ModuleDependenciesTableItem item = myItems.get(entry.getIdentifier());
            BuildFileStatement e = item.getEntry();
            return e instanceof Dependency || (e instanceof UnparseableStatement && !((UnparseableStatement) e).isComment());
        }
    };
}
Also used : BuildFileStatement(com.android.tools.idea.gradle.parser.BuildFileStatement) UnparseableStatement(com.android.tools.idea.gradle.parser.UnparseableStatement) Dependency(com.android.tools.idea.gradle.parser.Dependency)

Example 2 with Dependency

use of com.android.tools.idea.gradle.parser.Dependency in project android by JetBrains.

the class ModuleDependenciesTableModel method getRow.

public int getRow(@NotNull GradleCoordinate dependency) {
    int rowCount = getRowCount();
    for (int i = 0; i < rowCount; i++) {
        Object value = getValueAt(i, ITEM_COLUMN);
        if (value instanceof ModuleDependenciesTableItem) {
            BuildFileStatement entry = ((ModuleDependenciesTableItem) value).getEntry();
            if (entry instanceof Dependency) {
                String current = ((Dependency) entry).getValueAsString();
                GradleCoordinate currentCoordinate = GradleCoordinate.parseCoordinateString(current);
                if (currentCoordinate != null && dependency.equals(currentCoordinate)) {
                    return i;
                }
            }
        }
    }
    return -1;
}
Also used : BuildFileStatement(com.android.tools.idea.gradle.parser.BuildFileStatement) GradleCoordinate(com.android.ide.common.repository.GradleCoordinate) Dependency(com.android.tools.idea.gradle.parser.Dependency)

Aggregations

BuildFileStatement (com.android.tools.idea.gradle.parser.BuildFileStatement)2 Dependency (com.android.tools.idea.gradle.parser.Dependency)2 GradleCoordinate (com.android.ide.common.repository.GradleCoordinate)1 UnparseableStatement (com.android.tools.idea.gradle.parser.UnparseableStatement)1