use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class SyncMessages method report.
public void report(@NotNull SyncMessage message) {
String title = message.getGroup();
String text = join(message.getText(), "\n");
NotificationCategory category = message.getType().convertToCategory();
PositionInFile position = message.getPosition();
NotificationData notification = createNotification(title, text, category, position);
Navigatable navigatable = message.getNavigatable();
notification.setNavigatable(navigatable);
List<NotificationHyperlink> quickFixes = message.getQuickFixes();
if (!quickFixes.isEmpty()) {
updateNotification(notification, text, quickFixes);
}
report(notification);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class JdkPreSyncCheck method doCheckCanSync.
@Override
@NotNull
PreSyncCheckResult doCheckCanSync(@NotNull Project project) {
Sdk jdk = IdeSdks.getInstance().getJdk();
if (!isValidJdk(jdk)) {
String msg = "Please use JDK 8 or newer.";
SyncMessage message = new SyncMessage("Project sync error", MessageType.ERROR, msg);
List<NotificationHyperlink> quickFixes = Jdks.getInstance().getWrongJdkQuickFixes(project);
message.add(quickFixes);
SyncMessages.getInstance(project).report(message);
return failure(msg);
}
return SUCCESS;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink 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.hyperlink.NotificationHyperlink 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.hyperlink.NotificationHyperlink in project android by JetBrains.
the class Jdks method getWrongJdkQuickFixes.
@NotNull
public List<NotificationHyperlink> getWrongJdkQuickFixes(@NotNull Project project) {
List<NotificationHyperlink> quickFixes = Lists.newArrayList();
NotificationHyperlink useEmbeddedJdkHyperlink = UseEmbeddedJdkHyperlink.create();
if (useEmbeddedJdkHyperlink != null) {
quickFixes.add(useEmbeddedJdkHyperlink);
}
quickFixes.add(new DownloadJdk8Hyperlink());
NotificationHyperlink selectJdkHyperlink = SelectJdkFromFileSystemHyperlink.create(project);
if (selectJdkHyperlink != null) {
quickFixes.add(selectJdkHyperlink);
}
return quickFixes;
}
Aggregations