mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[platform] provide a way to specify a URL for "Getting Started" action in ExternalProductResourceUrls (IJPL-204)
IntelliJ IDEA has been migrated to use the new property. GitOrigin-RevId: 953eac505e8a7d2f8599625f37fcf4394dfb881f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7db90c1576
commit
eee554c5ba
@@ -16,7 +16,6 @@
|
||||
builtin-url="__BUILTIN_PLUGINS_URL__"/>
|
||||
|
||||
<help webhelp-url="https://www.jetbrains.com/help/idea/"/>
|
||||
<documentation url="https://www.jetbrains.com/idea/resources/"/>
|
||||
<whatsnew show-on-update="true"/>
|
||||
|
||||
<statistics settings="https://www.jetbrains.com/idea/statistics/stat-assistant.xml"
|
||||
|
||||
@@ -48,4 +48,7 @@ class IntelliJIdeaExternalResourceUrls : BaseJetBrainsExternalProductResourceUrl
|
||||
val suffix = if (SystemInfo.isMac) "_Mac" else ""
|
||||
return Urls.newFromEncoded("https://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard$suffix.pdf")
|
||||
}
|
||||
|
||||
override val gettingStartedPageUrl: Url
|
||||
get() = Urls.newFromEncoded("https://www.jetbrains.com/idea/resources/")
|
||||
}
|
||||
@@ -100,6 +100,14 @@ interface ExternalProductResourceUrls {
|
||||
*/
|
||||
val whatIsNewPageUrl: Url?
|
||||
get() = null
|
||||
|
||||
/**
|
||||
* Returns URL of the page containing introductory documentation of the product.
|
||||
* It's opened in the browser when a user invokes the "Getting Started" action.
|
||||
* If the property returns `null`, the action won't be shown.
|
||||
*/
|
||||
val gettingStartedPageUrl: Url?
|
||||
get() = null
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,19 +5,23 @@ import com.intellij.ide.BrowserUtil;
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.platform.ide.customization.ExternalProductResourceUrls;
|
||||
import com.intellij.util.Url;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class OnlineDocAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
BrowserUtil.browse(ApplicationInfoImpl.getShadowInstance().getDocumentationUrl());
|
||||
Url url = ExternalProductResourceUrls.getInstance().getGettingStartedPageUrl();
|
||||
if (url != null) {
|
||||
BrowserUtil.browse(url.toExternalForm());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final @NotNull AnActionEvent e) {
|
||||
e.getPresentation().setEnabledAndVisible(ApplicationInfoImpl.getShadowInstance().getDocumentationUrl() != null);
|
||||
e.getPresentation().setEnabledAndVisible(ExternalProductResourceUrls.getInstance().getGettingStartedPageUrl() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -84,4 +84,7 @@ class LegacyExternalProductResourceUrls : ExternalProductResourceUrls {
|
||||
|
||||
override val whatIsNewPageUrl: Url?
|
||||
get() = ApplicationInfoEx.getInstanceEx().whatsNewUrl?.let { Urls.newFromEncoded(it) }
|
||||
|
||||
override val gettingStartedPageUrl: Url?
|
||||
get() = ApplicationInfoEx.getInstanceEx().documentationUrl?.let { Urls.newFromEncoded(it) }
|
||||
}
|
||||
Reference in New Issue
Block a user