use of com.android.tools.idea.gradle.structure.model.PsModule in project android by JetBrains.
the class QuickFixes method setLibraryDependencyVersion.
private static void setLibraryDependencyVersion(@NonNls PsContext context, @NotNull String moduleName, @NotNull String dependency, @NotNull String version) {
PsModule module = context.getProject().findModuleByName(moduleName);
if (module instanceof PsAndroidModule) {
PsAndroidModule androidModule = (PsAndroidModule) module;
androidModule.forEachDeclaredDependency(declaredDependency -> {
if (declaredDependency instanceof PsLibraryDependency) {
setLibraryDependencyVersion((PsLibraryDependency) declaredDependency, dependency, version);
}
});
} else if (module instanceof PsJavaModule) {
PsJavaModule javaModule = (PsJavaModule) module;
javaModule.forEachDeclaredDependency(declaredDependency -> {
if (declaredDependency instanceof PsLibraryDependency) {
setLibraryDependencyVersion((PsLibraryDependency) declaredDependency, dependency, version);
}
});
}
}
use of com.android.tools.idea.gradle.structure.model.PsModule in project android by JetBrains.
the class BasePerspectiveConfigurable method putNavigationPath.
public void putNavigationPath(@NotNull Place place, @NotNull String moduleName, @NotNull String dependency) {
place.putPath(getNavigationPathName(), moduleName);
PsModule module = findModule(moduleName);
assert module != null;
MyNode node = findNodeByObject(myRoot, module);
assert node != null;
NamedConfigurable configurable = node.getConfigurable();
assert configurable instanceof BaseNamedConfigurable;
BaseNamedConfigurable dependenciesConfigurable = (BaseNamedConfigurable) configurable;
dependenciesConfigurable.putNavigationPath(place, dependency);
}
use of com.android.tools.idea.gradle.structure.model.PsModule in project android by JetBrains.
the class BasePerspectiveConfigurable method queryPlace.
@Override
public void queryPlace(@NotNull Place place) {
NamedConfigurable selectedConfigurable = getSelectedConfigurable();
if (selectedConfigurable instanceof BaseNamedConfigurable) {
PsModule module = ((BaseNamedConfigurable) selectedConfigurable).getEditableObject();
String moduleName = module.getName();
place.putPath(getNavigationPathName(), moduleName);
queryFurther(selectedConfigurable, place);
return;
}
place.putPath(getNavigationPathName(), "");
}
use of com.android.tools.idea.gradle.structure.model.PsModule in project android by JetBrains.
the class PsModuleCellRenderer method customizeCellRenderer.
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
if (value instanceof MasterDetailsComponent.MyNode) {
MasterDetailsComponent.MyNode node = (MasterDetailsComponent.MyNode) value;
NamedConfigurable namedConfigurable = node.getConfigurable();
if (namedConfigurable == null) {
return;
}
setIcon(namedConfigurable.getIcon(expanded));
setToolTipText(null);
setFont(getTreeFont());
SimpleTextAttributes textAttributes = REGULAR_ATTRIBUTES;
if (node.isDisplayInBold()) {
textAttributes = REGULAR_BOLD_ATTRIBUTES;
} else if (namedConfigurable instanceof BaseNamedConfigurable) {
PsModule module = ((BaseNamedConfigurable) namedConfigurable).getEditableObject();
List<PsIssue> issues = myContext.getAnalyzerDaemon().getIssues().findIssues(module, IssuesByTypeAndTextComparator.INSTANCE);
setToolTipText(getTooltipText(issues, true));
if (!issues.isEmpty()) {
PsIssue issue = issues.get(0);
Color waveColor = issue.getSeverity().getColor();
textAttributes = textAttributes.derive(STYLE_WAVED, null, null, waveColor);
}
}
append(node.getDisplayName(), textAttributes);
}
}
use of com.android.tools.idea.gradle.structure.model.PsModule in project android by JetBrains.
the class ChooseModuleDialog method doOKAction.
@Override
protected void doOKAction() {
super.doOKAction();
PsModule selectedModule = getSelectedModule();
assert selectedModule != null;
myOnOkTask.accept(selectedModule);
}
Aggregations