use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class BuildToolsTooLowReporter method report.
@Override
void report(@NotNull SyncIssue syncIssue, @NotNull Module module, @Nullable VirtualFile buildFile) {
String minimumVersion = syncIssue.getData();
assert minimumVersion != null;
SyncMessage message = new SyncMessage(SyncMessage.DEFAULT_GROUP, ERROR, syncIssue.getMessage());
List<NotificationHyperlink> quickFixes = myErrorHandler.getQuickFixHyperlinks(minimumVersion, module.getProject(), module);
message.add(quickFixes);
getSyncMessages(module).report(message);
}
use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class JdkModuleSetupStep method reportWrongJdkError.
@NotNull
private SyncMessage reportWrongJdkError(@NotNull Project project, @NotNull String text, @NotNull VirtualFile buildFile) {
int line = -1;
int column = -1;
Document document = FileDocumentManager.getInstance().getDocument(buildFile);
if (document != null) {
int offset = myCompileSdkVersionFinder.findOffsetIn(document.getText());
if (offset > -1) {
line = document.getLineNumber(offset);
if (line > -1) {
int lineStartOffset = document.getLineStartOffset(line);
column = offset - lineStartOffset;
}
}
}
PositionInFile position = new PositionInFile(buildFile, line, column);
SyncMessage msg = new SyncMessage(project, PROJECT_CONFIGURATION_SYNC_MESSAGE_GROUP, ERROR, position, text);
List<NotificationHyperlink> quickFixes = Lists.newArrayList(myJdks.getWrongJdkQuickFixes(project));
quickFixes.add(new OpenFileHyperlink(buildFile.getPath(), "Open build.gradle File", line, column));
msg.add(quickFixes);
return msg;
}
use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class JdkModuleSetupStep method reportWrongJdkError.
@NotNull
private SyncMessage reportWrongJdkError(@NotNull Project project, @NotNull String text) {
SyncMessage msg = new SyncMessage(PROJECT_CONFIGURATION_SYNC_MESSAGE_GROUP, ERROR, NonNavigatable.INSTANCE, text);
msg.add(myJdks.getWrongJdkQuickFixes(project));
return msg;
}
use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class UniquePathModuleValidatorStrategy method fixAndReportFoundIssues.
@Override
void fixAndReportFoundIssues() {
Set<String> modulePaths = myModulesByPath.keySet();
for (String modulePath : modulePaths) {
Collection<Module> modules = myModulesByPath.get(modulePath);
int moduleCount = modules.size();
if (moduleCount <= 1) {
continue;
}
StringBuilder msg = new StringBuilder();
msg.append("The modules [");
int i = 0;
Set<String> moduleNames = Sets.newHashSet();
for (Module module : modules) {
if (i++ != 0) {
msg.append(", ");
}
String name = module.getName();
moduleNames.add(name);
msg.append("'").append(name).append("'");
}
msg.append("] point to same directory in the file system.");
String[] lines = { msg.toString(), "Each module has to have a unique path." };
SyncMessage message = new SyncMessage(PROJECT_STRUCTURE_ISSUES, ERROR, lines);
List<DataNode<ModuleData>> modulesToDisplayInDialog = Lists.newArrayList();
Project project = getProject();
if (ProjectSubset.getInstance(project).isFeatureEnabled()) {
DataNode<ProjectData> projectInfo = DataNodeCaches.getInstance(project).getCachedProjectData();
if (projectInfo != null) {
Collection<DataNode<ModuleData>> cachedModules = findAll(projectInfo, MODULE);
for (DataNode<ModuleData> moduleNode : cachedModules) {
if (moduleNames.contains(moduleNode.getData().getExternalName())) {
modulesToDisplayInDialog.add(moduleNode);
}
}
}
}
if (!modulesToDisplayInDialog.isEmpty()) {
message.add(new AddOrRemoveModulesHyperlink());
}
SyncMessages.getInstance(project).report(message);
}
}
use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class BuildTools23Rc1ValidationStrategy method fixAndReportFoundIssues.
@Override
void fixAndReportFoundIssues() {
if (!myModules.isEmpty()) {
sort(myModules);
StringBuilder msg = new StringBuilder();
// @formatter:off
msg.append("Build Tools 23.0.0 rc1 is <b>deprecated</b>.<br>\n").append("Please update these modules to use Build Tools 23.0.0 rc2 (or newer) instead:");
for (String module : myModules) {
msg.append("<br>\n * ").append(module);
}
msg.append("<br>\n<br>\nOtherwise the project won't build. ");
Project project = getProject();
SyncMessage message = new SyncMessage(DEFAULT_GROUP, ERROR, msg.toString());
SyncMessages.getInstance(project).report(message);
GradleSyncState.getInstance(project).getSummary().setSyncErrorsFound(true);
}
}
Aggregations