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);
}
}
use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class EncodingValidationStrategy method fixAndReportFoundIssues.
@Override
void fixAndReportFoundIssues() {
if (myMismatchingEncoding != null) {
Project project = getProject();
// Fix encoding mismatch.
myEncodings.setDefaultCharsetName(myMismatchingEncoding);
// Report encoding mismatch.
String line = String.format("The project encoding (%1$s) has been reset to the encoding specified in the Gradle build files (%2$s).", myEncodings.getDefaultCharset().displayName(), myMismatchingEncoding);
String[] text = { line, "Mismatching encodings can lead to serious bugs." };
SyncMessage message = new SyncMessage(SyncMessage.DEFAULT_GROUP, INFO, text);
message.add(new OpenUrlHyperlink("http://tools.android.com/knownissues/encoding", "More Info..."));
SyncMessages.getInstance(project).report(message);
}
}
use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class ExtraGeneratedFolderValidationStrategy method fixAndReportFoundIssues.
@Override
void fixAndReportFoundIssues() {
if (!myExtraGeneratedSourceFolderPaths.isEmpty()) {
SyncMessages messages = SyncMessages.getInstance(getProject());
Collections.sort(myExtraGeneratedSourceFolderPaths);
// Warn users that there are generated source folders at the wrong location.
for (File folder : myExtraGeneratedSourceFolderPaths) {
// Have to add a word before the path, otherwise IDEA won't show it.
String[] text = { "Folder " + folder.getPath() };
messages.report(new SyncMessage(GENERATED_SOURCES, WARNING, text));
}
messages.report(new SyncMessage(GENERATED_SOURCES, INFO, "3rd-party Gradle plug-ins may be the cause"));
}
}
Aggregations