customizable URL for whatsnew action
authorDmitry Jemerov <yole@jetbrains.com>
Thu, 15 Oct 2009 09:25:33 +0000 (13:25 +0400)
committerDmitry Jemerov <yole@jetbrains.com>
Thu, 15 Oct 2009 09:25:33 +0000 (13:25 +0400)
platform/platform-impl/src/com/intellij/ide/actions/WhatsNewAction.java [moved from java/idea-ui/src/com/intellij/ide/actions/WhatsNewAction.java with 76% similarity]
platform/platform-impl/src/com/intellij/openapi/application/ex/ApplicationInfoEx.java
platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java

similarity index 76%
rename from java/idea-ui/src/com/intellij/ide/actions/WhatsNewAction.java
rename to platform/platform-impl/src/com/intellij/ide/actions/WhatsNewAction.java
index e1f3fe4e6ab85b2e6a2fc86b5bc56d3433bc18f5..15090dd47b6807d11458d6b6b9e219b529a41cd5 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.ide.actions;
 import com.intellij.ide.BrowserUtil;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.application.ex.ApplicationInfoEx;
 import com.intellij.openapi.project.DumbAware;
 
 /**
@@ -25,6 +26,11 @@ import com.intellij.openapi.project.DumbAware;
  */
 public class WhatsNewAction extends AnAction implements DumbAware {
   public void actionPerformed(AnActionEvent e) {
-    BrowserUtil.launchBrowser("http://www.jetbrains.com/idea/features/newfeatures.html");
+    BrowserUtil.launchBrowser(ApplicationInfoEx.getInstanceEx().getWhatsNewUrl());
+  }
+
+  @Override
+  public void update(AnActionEvent e) {
+    e.getPresentation().setVisible(ApplicationInfoEx.getInstanceEx().getWhatsNewUrl() != null);
   }
 }
index 2ba037f0f4430b8d69825816fafc6f9967ec92a4..a2a1bdc031ca4218bb8f69c4bbbfce9bade319c2 100644 (file)
@@ -81,6 +81,8 @@ public abstract class ApplicationInfoEx extends ApplicationInfo {
 
   public abstract String getWebHelpUrl();
 
+  public abstract String getWhatsNewUrl();
+
   public interface UpdateUrls {
     String getCheckingUrl();
     String getPatchesUrl();
index acbb0daa0042338183c8339e44603cb61c273df1..3a9061d4b63f652afed17f148308fc05661c6481 100644 (file)
@@ -64,6 +64,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
   private String myPluginsListUrl;
   private String myPluginsDownloadUrl;
   private String myDefaultUpdateChannel;
+  private String myWhatsNewUrl;
   private boolean myEAP;
   @NonNls private String myHelpFileName = "ideahelp.jar";
   @NonNls private String myHelpRootName = "idea";
@@ -110,6 +111,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
   @NonNls private static final String ATTRIBUTE_LIST_URL = "list-url";
   @NonNls private static final String ATTRIBUTE_DOWNLOAD_URL = "download-url";
   @NonNls private static final String ATTRIBUTE_WEBHELP_URL = "webhelp-url";
+  @NonNls private static final String ELEMENT_WHATSNEW = "whatsnew";
 
   public void initComponent() { }
 
@@ -232,11 +234,14 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
     return myPluginsDownloadUrl;
   }
 
-  @Override
   public String getWebHelpUrl() {
     return myWebHelpUrl;
   }
 
+  public String getWhatsNewUrl() {
+    return myWhatsNewUrl;
+  }
+
   public String getFullApplicationName() {
     @NonNls StringBuilder buffer = new StringBuilder();
     buffer.append(getVersionName());
@@ -391,6 +396,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
       myReleaseFeedbackUrl = feedbackElement.getAttributeValue(ATTRIBUTE_RELEASE_URL);
     }
 
+    Element whatsnewElement = parentNode.getChild(ELEMENT_WHATSNEW);
+    if (whatsnewElement != null) {
+      myWhatsNewUrl = whatsnewElement.getAttributeValue(ATTRIBUTE_URL);
+    }
+
     myPluginsListUrl = "http://plugins.intellij.net/plugins/list/";
     myPluginsDownloadUrl = "http://plugins.intellij.net/pluginManager";