IDEA-126493 (one action to rule them all, conveniently configurable via app. info file)

This commit is contained in:
Roman Shevchenko
2015-01-06 18:33:53 +01:00
parent bdc0e82095
commit 0e57b3032e
10 changed files with 36 additions and 48 deletions
@@ -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"/>
@@ -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();
@@ -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) {
@@ -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.
@@ -13,35 +13,32 @@
* 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);
}
}
}
@@ -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);
}
}
@@ -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
@@ -434,7 +434,7 @@
<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"/>
@@ -518,10 +518,9 @@
</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>
@@ -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>
@@ -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>
@@ -363,8 +363,6 @@
</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"/>