use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class ConflictSet method showSelectionConflicts.
/**
* Shows the "variant selection" conflicts in the "Build Variant" and "Messages" windows.
*/
public void showSelectionConflicts() {
SyncMessages messages = SyncMessages.getInstance(myProject);
String groupName = VARIANT_SELECTION_CONFLICTS;
messages.removeMessages(groupName);
for (Conflict conflict : mySelectionConflicts) {
// Creates the "Select in 'Build Variants' window" hyperlink.
Module source = conflict.getSource();
String hyperlinkText = String.format("Select '%1$s' in \"Build Variants\" window", source.getName());
NotificationHyperlink selectInBuildVariantsWindowHyperlink = new NotificationHyperlink("select.conflict.in.variants.window", hyperlinkText) {
@Override
protected void execute(@NotNull Project project) {
BuildVariantView.getInstance(project).findAndSelect(source);
}
};
// Creates the "Fix problem" hyperlink.
NotificationHyperlink quickFixHyperlink = new NotificationHyperlink("fix.conflict", "Fix problem") {
@Override
protected void execute(@NotNull Project project) {
boolean solved = solveSelectionConflict(conflict);
if (solved) {
ConflictSet conflicts = findConflicts(project);
conflicts.showSelectionConflicts();
}
}
};
SyncMessage msg = new SyncMessage(groupName, MessageType.WARNING, conflict.toString());
msg.add(selectInBuildVariantsWindowHyperlink);
msg.add(quickFixHyperlink);
messages.report(msg);
}
BuildVariantView.getInstance(myProject).updateContents(mySelectionConflicts);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class NdkIntegrationDeprecatedErrorHandler method getQuickFixHyperlinks.
@Override
@NotNull
protected List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
hyperlinks.add(new OpenUrlHyperlink("https://developer.android.com/studio/build/experimental-plugin.html", "Consider trying the new experimental plugin"));
hyperlinks.add(new SetUseDeprecatedNdkHyperlink());
return hyperlinks;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class OldAndroidPluginErrorHandler method getQuickFixHyperlinks.
@Override
@NotNull
protected List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
hyperlinks.add(new FixAndroidGradlePluginVersionHyperlink());
AndroidPluginInfo result = searchInBuildFilesOnly(project);
if (result != null && result.getPluginBuildFile() != null) {
hyperlinks.add(new OpenFileHyperlink(result.getPluginBuildFile().getPath()));
}
return hyperlinks;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class SdkBuildToolsTooLowErrorHandler method getQuickFixHyperlinks.
@NotNull
public List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull String minimumVersion, @NotNull Project project, @Nullable Module module) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
boolean buildToolInstalled = false;
AndroidSdkHandler sdkHandler = null;
AndroidSdkData androidSdkData = AndroidSdks.getInstance().tryToChooseAndroidSdk();
if (androidSdkData != null) {
sdkHandler = androidSdkData.getSdkHandler();
}
if (sdkHandler != null) {
ProgressIndicator progress = new StudioLoggerProgressIndicator(SdkBuildToolsTooLowErrorHandler.class);
RepositoryPackages packages = sdkHandler.getSdkManager(progress).getPackages();
LocalPackage buildTool = packages.getLocalPackages().get(getBuildToolsPath(parseRevision(minimumVersion)));
buildToolInstalled = buildTool != null;
}
if (module != null) {
VirtualFile buildFile = getGradleBuildFile(module);
AndroidPluginInfo androidPluginInfo = AndroidPluginInfo.find(project);
if (!buildToolInstalled) {
if (androidPluginInfo != null && androidPluginInfo.isExperimental()) {
hyperlinks.add(new InstallBuildToolsHyperlink(minimumVersion, null));
} else {
hyperlinks.add(new InstallBuildToolsHyperlink(minimumVersion, buildFile));
}
} else if (buildFile != null && androidPluginInfo != null && !androidPluginInfo.isExperimental()) {
hyperlinks.add(new FixBuildToolsVersionHyperlink(buildFile, minimumVersion));
}
if (buildFile != null) {
hyperlinks.add(new OpenFileHyperlink(buildFile.getPath()));
}
}
return hyperlinks;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class UnexpectedErrorHandler method getQuickFixHyperlinks.
@Override
@NotNull
protected List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
hyperlinks.add(new FileBugHyperlink());
hyperlinks.add(new ShowLogHyperlink());
return hyperlinks;
}
Aggregations