in designer/src/com/android/tools/idea/rendering/StudioHtmlLinkManager.java [156:260]
public void handleUrl(@NotNull String url, @Nullable Module module, @NotNull PsiFile file,
boolean hasRenderResult, @NotNull HtmlLinkManager.RefreshableSurface surface) {
if (url.startsWith("http:") || url.startsWith("https:")) {
BrowserLauncher.getInstance().browse(url, null, module == null ? null : module.getProject());
}
else if (url.startsWith("file:")) {
assert module != null;
handleFileUrl(url, module);
}
else if (url.startsWith(URL_REPLACE_TAGS)) {
assert module != null;
handleReplaceTagsUrl(url, module, file);
}
else if (url.equals(URL_BUILD_FOR_RENDERING)) {
assert module != null;
handleBuildForRenderingUrl(url, file);
}
else if (url.equals(URL_BUILD)) {
assert module != null;
handleBuildProjectUrl(url, module.getProject());
}
else if (url.equals(URL_SYNC)) {
assert module != null;
handleSyncProjectUrl(url, module.getProject());
}
else if (url.equals(URL_EDIT_CLASSPATH)) {
assert module != null;
handleEditClassPathUrl(url, module);
}
else if (url.startsWith(URL_CREATE_CLASS)) {
assert module != null;
handleNewClassUrl(url, module);
}
else if (url.startsWith(URL_OPEN)) {
assert module != null;
handleOpenStackUrl(url, module);
}
else if (url.startsWith(URL_OPEN_CLASS)) {
assert module != null;
handleOpenClassUrl(url, module);
}
else if (url.equals(URL_SHOW_XML)) {
assert module != null;
handleShowXmlUrl(url, module, file);
}
else if (url.startsWith(URL_SHOW_TAG)) {
assert module != null;
handleShowTagUrl(url, module, file);
}
else if (url.startsWith(URL_ASSIGN_FRAGMENT_URL)) {
assert module != null;
handleAssignFragmentUrl(url, module, file);
}
else if (url.startsWith(URL_ASSIGN_LAYOUT_URL)) {
assert module != null;
handleAssignLayoutUrl(url, module, file);
}
else if (url.equals(URL_ACTION_IGNORE_FRAGMENTS)) {
assert hasRenderResult;
handleIgnoreFragments(url, surface);
}
else if (url.startsWith(URL_EDIT_ATTRIBUTE)) {
assert hasRenderResult;
if (module != null) {
handleEditAttribute(url, module, file);
}
}
else if (url.startsWith(URL_REPLACE_ATTRIBUTE_VALUE)) {
assert hasRenderResult;
if (module != null) {
handleReplaceAttributeValue(url, module, file);
}
}
else if (url.startsWith(URL_DISABLE_SANDBOX)) {
assert module != null;
handleDisableSandboxUrl(module, surface);
}
else if (url.startsWith(URL_RUNNABLE)) {
Action linkRunnable = getLinkRunnable(url);
if (linkRunnable instanceof ShowExceptionFix) {
((ShowExceptionFix)linkRunnable).showException(module, file, this);
}
else if (linkRunnable != null) {
linkRunnable.actionPerformed(module);
}
}
else if ((url.startsWith(URL_ADD_DEPENDENCY) || url.startsWith(URL_ADD_DEBUG_DEPENDENCY)) && module != null) {
handleAddDependency(url, module);
ProjectSystemUtil.getSyncManager(module.getProject())
.requestSyncProject(ProjectSystemSyncManager.SyncReason.PROJECT_MODIFIED);
}
else if (url.startsWith(URL_REFRESH_RENDER)) {
surface.handleRefreshRenderUrl();
}
else if (url.startsWith(URL_CLEAR_CACHE_AND_NOTIFY)) {
// This does the same as URL_REFRESH_RENDERER with the only difference of displaying a notification afterwards. The reason to have
// handler is that we have different entry points for the action, one of which is "Clear cache". The user probably expects a result
// of clicking that link that has something to do with the cache being cleared.
surface.handleRefreshRenderUrl();
showNotification("Cache cleared");
}
else {
assert false : "Unexpected URL: " + url;
}
}