IDEA-126493 (one action to rule them all, conveniently configurable via app. info...
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Tue, 6 Jan 2015 17:32:05 +0000 (18:32 +0100)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Tue, 6 Jan 2015 17:33:53 +0000 (18:33 +0100)
community-resources/src/idea/IdeaApplicationInfo.xml
platform/core-api/src/com/intellij/openapi/application/ApplicationInfo.java
platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
platform/platform-impl/src/com/intellij/ide/actions/JetBrainsTvAction.java [moved from platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/JetBrainsTvAction.java with 53% similarity]
platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/IdeaJetBrainsTvAction.java [deleted file]
platform/platform-resources-en/src/messages/ActionsBundle.properties
platform/platform-resources/src/idea/PlatformActions.xml
python/edu/resources/idea/PyCharmEduApplicationInfo.xml
python/resources/idea/PyCharmCoreApplicationInfo.xml
resources/src/idea/RichPlatformActions.xml

index 0e6bb914828b5c254d2282fb51a4923e2b770f57..d21b3f47b145670fec8860e176d3d9bb5d6522fc 100644 (file)
@@ -28,6 +28,7 @@
   <keymap win="https://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard.pdf"
           mac="https://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard_Mac.pdf"/>
   <third-party url="https://www.jetbrains.org/"/>
+  <jetbrains-tv url="https://www.youtube.com/user/intellijideavideo"/>
 
   <plugins-page category="VCS Integration" title="Select VCS Integration Plugins"/>
   <plugins-page title="Select Other Plugins"/>
index 576cdc097de8237c0a420a525a3478898885f5da..49fb9077e25cb6e8cb3d79767e9020ba621a7f1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -32,6 +32,8 @@ public abstract class ApplicationInfo {
   public abstract String getCompanyName();
   public abstract String getCompanyURL();
   public abstract String getThirdPartySoftwareURL();
+  public abstract String getJetbrainsTvUrl();
+
   public abstract Rectangle getAboutLogoRect();
   public abstract boolean hasHelp();
   public abstract boolean hasContextHelp();
index 01f9a435d074e7e6f453bed1b92eee3e92f29d62..d75c5d8e6b7c83ecdc54f688d400dc55c3afeae5 100644 (file)
@@ -98,6 +98,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
   private String myStatisticsServiceUrl;
   private String myStatisticsServiceKey;
   private String myThirdPartySoftwareUrl;
+  private String myJetbrainsTvUrl;
 
   private Rectangle myAboutLogoRect;
 
@@ -167,6 +168,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
   private static final String ATTRIBUTE_STATISTICS_SERVICE = "service";
   private static final String ATTRIBUTE_STATISTICS_SERVICE_KEY = "service-key";
   private static final String ELEMENT_THIRD_PARTY = "third-party";
+  private static final String ELEMENT_JB_TV = "jetbrains-tv";
   private static final String CUSTOMIZE_IDE_WIZARD_STEPS = "customize-ide-wizard";
   private static final String STEPS_PROVIDER = "provider";
 
@@ -466,6 +468,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
     return myThirdPartySoftwareUrl;
   }
 
+  @Override
+  public String getJetbrainsTvUrl() {
+    return myJetbrainsTvUrl;
+  }
+
   @Override
   public Rectangle getAboutLogoRect() {
     return myAboutLogoRect;
@@ -736,6 +743,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
     if (thirdPartyElement != null) {
       myThirdPartySoftwareUrl = thirdPartyElement.getAttributeValue(ATTRIBUTE_URL);
     }
+
+    Element tvElement = parentNode.getChild(ELEMENT_JB_TV);
+    if (tvElement != null) {
+      myJetbrainsTvUrl = tvElement.getAttributeValue(ATTRIBUTE_URL);
+    }
   }
 
   private static GregorianCalendar parseDate(final String dateString) {
similarity index 53%
rename from platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/JetBrainsTvAction.java
rename to platform/platform-impl/src/com/intellij/ide/actions/JetBrainsTvAction.java
index 184f3444175e20d69c67bddebd1dd8c6ee2d5d9a..9c1798df574b2b9b7dd04ae3a3e34c38409953dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.intellij.openapi.wm.impl.welcomeScreen;
+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.ApplicationNamesInfo;
+import com.intellij.openapi.application.ApplicationInfo;
 import com.intellij.openapi.project.DumbAware;
-import com.intellij.ui.UIBundle;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
 
 public class JetBrainsTvAction extends AnAction implements DumbAware {
-  public static final String JETBRAINS_TV_URL = "http://tv.jetbrains.net/";
-
   private final String myUrl;
 
   public JetBrainsTvAction() {
-    myUrl = JETBRAINS_TV_URL;
+    myUrl = ApplicationInfo.getInstance().getJetbrainsTvUrl();
   }
 
-  protected JetBrainsTvAction(@NotNull @NonNls final String channel) {
-    final String fullProductName = ApplicationNamesInfo.getInstance().getFullProductName();
-    getTemplatePresentation().setText(fullProductName + " TV");
-    getTemplatePresentation().setDescription(UIBundle.message("welcome.screen.jetbrains.tv.action.description", fullProductName));
-    myUrl = JETBRAINS_TV_URL + "channel/" + channel;
+  @Override
+  public void update(AnActionEvent e) {
+    boolean enabled = myUrl != null;
+    e.getPresentation().setVisible(enabled);
+    e.getPresentation().setEnabled(enabled);
   }
 
   @Override
   public void actionPerformed(AnActionEvent e) {
-    BrowserUtil.browse(myUrl);
+    if (myUrl != null) {
+      BrowserUtil.browse(myUrl);
+    }
   }
 }
\ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/IdeaJetBrainsTvAction.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/IdeaJetBrainsTvAction.java
deleted file mode 100644 (file)
index a5035e3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2000-2010 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.wm.impl.welcomeScreen;
-
-public class IdeaJetBrainsTvAction extends JetBrainsTvAction {
-  private static final String CHANNEL = "intellij-idea";
-
-  public IdeaJetBrainsTvAction() {
-    super(CHANNEL);
-  }
-}
index 559d00a6bd0814833b592d097d1d6fba62fedaba..399a743331b08f0c41a21e5f38234dcc2f70e828 100644 (file)
@@ -1240,7 +1240,8 @@ action.WelcomeScreen.CreateNewProject.text=Create New Project
 action.WelcomeScreen.CreateNewProject.description=Start the \"New Project\" Wizard that will guide you through the steps necessary for creating a new project.
 action.WelcomeScreen.ImportProject.text=Import Project
 action.WelcomeScreen.ImportProject.description=Create {0} project structure for directory with existing sources or convert existing project model.
-action.WelcomeScreen.JetBrainsTV.IDEA.text=JetBrains TV
+action.WelcomeScreen.JetBrainsTV.text=JetBrains TV
+action.WelcomeScreen.JetBrainsTV.description=View short live demos introducing features of JetBrains products.
 action.WelcomeScreen.Plugins.text=Plugins
 action.WelcomeScreen.Plugins.description=Manage installed plugins and download new ones from repository
 action.WelcomeScreen.Configure.Import.text=Import Settings
index c31a4715cf88f13a5cf57e762fe9046dd3533d1f..0be31cc6dec1b58179680a3e7b4af11ee854764b 100644 (file)
         <separator/>
         <action id="OnlineDocAction" class="com.intellij.ide.actions.OnlineDocAction"/>
         <action id="Help.KeymapReference" class="com.intellij.ide.actions.RefCardAction" icon="AllIcons.General.DefaultKeymap"/>
-        <action id="Help.JetBrainsTV" class="com.intellij.openapi.wm.impl.welcomeScreen.JetBrainsTvAction"/>
+        <action id="Help.JetBrainsTV" class="com.intellij.ide.actions.JetBrainsTvAction"/>
         <separator/>
         <action id="CheckForUpdate" class="com.intellij.openapi.updateSettings.impl.CheckForUpdateAction"/>
         <action id="About" class="com.intellij.ide.actions.AboutAction"/>
     </group>
 
     <group id="WelcomeScreen.Documentation">
-      <action id="WelcomeScreen.ReadHelp" class="com.intellij.ide.actions.HelpTopicsAction"
-        icon="AllIcons.General.ReadHelp"/>
-      <action id="WelcomeScreen.ShowTips" class="com.intellij.ide.actions.ShowTipsAction"
-        icon="AllIcons.General.TipsOfTheDay"/>
+      <action id="WelcomeScreen.ReadHelp" class="com.intellij.ide.actions.HelpTopicsAction" icon="AllIcons.General.ReadHelp"/>
+      <action id="WelcomeScreen.ShowTips" class="com.intellij.ide.actions.ShowTipsAction" icon="AllIcons.General.TipsOfTheDay"/>
+      <action id="WelcomeScreen.JetBrainsTV" class="com.intellij.ide.actions.JetBrainsTvAction"/>
       <reference ref="Help.KeymapReference"/>
     </group>
 
index 637ae3f741c6c8e1eae31a10f974d1404bf9941e..a2172acca92c5f1b13d32a967d44b997b426850f 100644 (file)
@@ -19,4 +19,5 @@
             release-url="https://www.jetbrains.com/feedback/feedback.jsp?product=PyCharm&amp;build=$BUILD&amp;timezone=$TIMEZONE&amp;eval=$EVAL"/>
   <help file="pycharm-eduhelp.jar" root="pycharm-edu"/>
   <third-party url="https://confluence.jetbrains.com/display/PYH/Third-Party+Software+Used+by+PyCharm"/>
+  <jetbrains-tv url="http://www.youtube.com/user/JetBrainsTV/search?query=PyCharm"/>
 </component>
index 8fda1df37a1fdcf26a9bdaec17c4c1dc8a5751bf..bd632c395fdb40365ccf54c09a846394af5c18e3 100644 (file)
@@ -19,4 +19,5 @@
             release-url="https://www.jetbrains.com/feedback/feedback.jsp?product=PyCharm&amp;build=$BUILD&amp;timezone=$TIMEZONE&amp;eval=$EVAL"/>
   <help file="pycharmhelp.jar" root="pycharm"/>
   <third-party url="https://confluence.jetbrains.com/display/PYH/Third-Party+Software+Used+by+PyCharm"/>
+  <jetbrains-tv url="http://www.youtube.com/user/JetBrainsTV/search?query=PyCharm"/>
 </component>
index 1f534708c21bd9041038b85347febdd77dba9b23..be17a4a46aaa711beb3b128a5fd8ad4499238ec2 100644 (file)
     </group>
 
     <group id="WelcomeScreen.Documentation.IDEA">
-      <action id="WelcomeScreen.JetBrainsTV.IDEA" class="com.intellij.openapi.wm.impl.welcomeScreen.IdeaJetBrainsTvAction"
-              icon="AllIcons.General.JetbrainsTvIdea"/>
       <action id="WelcomeScreen.DevelopPlugins" class="com.intellij.openapi.wm.impl.welcomeScreen.DevelopPluginsAction"
               icon="AllIcons.General.PluginManager"/>