From d5e4cfb8ca51a4077fc7965a8cb2cfa340c5b737 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Fri, 16 Nov 2012 21:28:55 +0400 Subject: [PATCH] Customizable Configure items. --- .../openapi/actionSystem/IdeActions.java | 1 + .../ide/actions/ShowPluginManagerAction.java | 40 +++++++++++++++ .../impl/welcomeScreen/BottomLineBorder.java | 21 ++++++++ .../impl/welcomeScreen}/CardActionsPanel.java | 5 +- .../impl/welcomeScreen/NewWelcomeScreen.java | 51 ++++--------------- .../welcomeScreen/RecentProjectPanel.java | 1 + .../wm/impl/welcomeScreen/WelcomePane.java | 1 - .../src/messages/ActionsBundle.properties | 10 ++++ .../src/idea/PlatformActions.xml | 10 ++++ resources/src/idea/RichPlatformActions.xml | 8 +++ 10 files changed, 104 insertions(+), 44 deletions(-) create mode 100644 platform/platform-impl/src/com/intellij/ide/actions/ShowPluginManagerAction.java create mode 100644 platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/BottomLineBorder.java rename platform/platform-impl/src/com/intellij/{ui => openapi/wm/impl/welcomeScreen}/CardActionsPanel.java (96%) diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java index 28979e48f084..05b3bc183220 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java @@ -228,6 +228,7 @@ public interface IdeActions { @NonNls String GROUP_WELCOME_SCREEN_QUICKSTART = "WelcomeScreen.QuickStart"; @NonNls String GROUP_WELCOME_SCREEN_DOC = "WelcomeScreen.Documentation"; + @NonNls String GROUP_WELCOME_SCREEN_CONFIGURE = "WelcomeScreen.Configure"; @NonNls String ACTION_KEYMAP_REFERENCE="Help.KeymapReference"; @NonNls String ACTION_MOVE = "Move"; @NonNls String ACTION_RENAME = "RenameElement"; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowPluginManagerAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowPluginManagerAction.java new file mode 100644 index 000000000000..896dbce38252 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowPluginManagerAction.java @@ -0,0 +1,40 @@ +/* + * Copyright 2000-2012 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. + */ + +/* + * @author max + */ +package com.intellij.ide.actions; + +import com.intellij.ide.plugins.PluginManagerConfigurable; +import com.intellij.ide.plugins.PluginManagerUISettings; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.options.ShowSettingsUtil; +import com.intellij.openapi.project.DumbAware; + +import java.awt.*; + +public class ShowPluginManagerAction extends AnAction implements DumbAware { + + @Override + public void actionPerformed(AnActionEvent e) { + Component component = e.getData(PlatformDataKeys.CONTEXT_COMPONENT); + final PluginManagerConfigurable configurable = new PluginManagerConfigurable(PluginManagerUISettings.getInstance()); + ShowSettingsUtil.getInstance().editConfigurable(component, configurable); + } +} diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/BottomLineBorder.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/BottomLineBorder.java new file mode 100644 index 000000000000..009011730c49 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/BottomLineBorder.java @@ -0,0 +1,21 @@ +/* + * @author max + */ +package com.intellij.openapi.wm.impl.welcomeScreen; + +import com.intellij.ui.Gray; + +import javax.swing.border.EmptyBorder; +import java.awt.*; + +public class BottomLineBorder extends EmptyBorder { + public BottomLineBorder() { + super(0, 0, 1, 0); + } + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { + g.setColor(Gray._190); + g.drawLine(x, y + height - 1, x + width, y + height - 1); + } +} diff --git a/platform/platform-impl/src/com/intellij/ui/CardActionsPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/CardActionsPanel.java similarity index 96% rename from platform/platform-impl/src/com/intellij/ui/CardActionsPanel.java rename to platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/CardActionsPanel.java index 37ed5f7f44f3..750dc06efcab 100644 --- a/platform/platform-impl/src/com/intellij/ui/CardActionsPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/CardActionsPanel.java @@ -17,11 +17,13 @@ /* * @author max */ -package com.intellij.ui; +package com.intellij.openapi.wm.impl.welcomeScreen; import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.impl.ActionButtonWithText; +import com.intellij.ui.Gray; +import com.intellij.ui.JBCardLayout; import javax.swing.*; import javax.swing.border.EmptyBorder; @@ -121,6 +123,7 @@ public class CardActionsPanel extends JPanel { JLabel title = new JLabel(text); title.setHorizontalAlignment(SwingConstants.CENTER); add(title, BorderLayout.CENTER); + setBorder(new BottomLineBorder()); } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewWelcomeScreen.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewWelcomeScreen.java index 404653756360..b1b815c39912 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewWelcomeScreen.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/NewWelcomeScreen.java @@ -19,13 +19,9 @@ */ package com.intellij.openapi.wm.impl.welcomeScreen; -import com.intellij.ide.plugins.PluginManagerConfigurable; -import com.intellij.ide.plugins.PluginManagerUISettings; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationInfo; import com.intellij.openapi.application.ApplicationNamesInfo; -import com.intellij.openapi.options.ShowSettingsUtil; -import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.wm.WelcomeScreen; import com.intellij.ui.Gray; @@ -73,26 +69,19 @@ public class NewWelcomeScreen extends JPanel implements WelcomeScreen { root.add(child); } - WelcomeScreenGroup settings = new WelcomeScreenGroup(placeholderIcon, "Configure"); - root.add(settings); - settings.add(new WelcomeScreenAction(placeholderIcon, "Plugins") { - @Override - public void actionPerformed(AnActionEvent e) { - final PluginManagerConfigurable configurable = new PluginManagerConfigurable(PluginManagerUISettings.getInstance()); - ShowSettingsUtil.getInstance().editConfigurable(NewWelcomeScreen.this, configurable); - } - }); + root.add(buildRootGroup(placeholderIcon, "Configure", IdeActions.GROUP_WELCOME_SCREEN_CONFIGURE)); + root.add(buildRootGroup(placeholderIcon, "Docs and How-Tos", IdeActions.GROUP_WELCOME_SCREEN_DOC)); - settings.add(actionManager.getAction("ShowSettings")); + return new WelcomePane(root); + } - WelcomeScreenGroup docs = new WelcomeScreenGroup(placeholderIcon, "Docs and How-Tos"); - root.add(docs); - ActionGroup docsActions = (ActionGroup)actionManager.getAction(IdeActions.GROUP_WELCOME_SCREEN_DOC); + private WelcomeScreenGroup buildRootGroup(Icon groupIcon, String groupText, String groupId) { + WelcomeScreenGroup docs = new WelcomeScreenGroup(groupIcon, groupText); + ActionGroup docsActions = (ActionGroup)ActionManager.getInstance().getAction(groupId); for (AnAction child : docsActions.getChildren(null)) { docs.add(child); } - - return new WelcomePane(root); + return docs; } private JPanel createFooterPanel() { @@ -126,13 +115,7 @@ public class NewWelcomeScreen extends JPanel implements WelcomeScreen { header.add(welcome); header.setBackground(Gray._220); - header.setBorder(new EmptyBorder(0, 0, 1, 0) { - @Override - public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { - g.setColor(Gray._190); - g.drawLine(x, y + height - 1, x + width, y + height - 1); - } - }); + header.setBorder(new BottomLineBorder()); return header; } @@ -156,20 +139,4 @@ public class NewWelcomeScreen extends JPanel implements WelcomeScreen { getTemplatePresentation().setIcon(icon); } } - - private class WelcomeScreenAction extends AnAction { - private WelcomeScreenAction(Icon icon, String text) { - super(text, null, icon); - } - - @Override - public boolean displayTextInToolbar() { - return true; - } - - @Override - public void actionPerformed(AnActionEvent e) { - Messages.showInfoMessage(NewWelcomeScreen.this, getTemplatePresentation().getText() + " is not implemented!", "Not Implemented!!!"); - } - } } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java index ead6184ebb77..023e718de475 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java @@ -139,6 +139,7 @@ public class RecentProjectPanel extends JPanel { return new Dimension(super.getPreferredSize().width, 28); } }; + title.setBorder(new BottomLineBorder()); JLabel titleLabel = new JLabel("Recent Projects"); title.add(titleLabel); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomePane.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomePane.java index 369293579f3a..be7c2ae80752 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomePane.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomePane.java @@ -20,7 +20,6 @@ package com.intellij.openapi.wm.impl.welcomeScreen; import com.intellij.openapi.actionSystem.ActionGroup; -import com.intellij.ui.CardActionsPanel; import com.intellij.ui.Gray; import javax.swing.*; diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index f25c385dc94b..2640254ca601 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -1149,6 +1149,16 @@ action.WelcomeScreen.CreateNewProject.description=Start the \"New Project\" Wiza 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.Settings.text=Settings +action.WelcomeScreen.Settings.description=Edit Settings +action.WelcomeScreen.Plugins.text=Plugins +action.WelcomeScreen.Plugins.description=Manage installed plugins and download new ones from repository +action.WelcomeScreen.Configure.Template_Project_Settings.text=Template Project Settings +action.WelcomeScreen.Configure.Template_Project_Settings.description=Configure template settings for all new projects +action.WelcomeScreen.Configure.Template_Project_Structure.text=Template Project Structure +action.WelcomeScreen.Configure.Template_Project_Structure.description=Configure template structure for all new projects +action.WelcomeScreen.Configure.Import.text=Import Settings +action.WelcomeScreen.Configure.Export.text=Export Settings action.CommittedChanges.Revert.text=Revert Changes action.CommittedChanges.Revert.description=Apply the reverse of the selected changes to the working copy diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 9a9be4eff06f..f3ff0eea303a 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -462,6 +462,16 @@ + + + + + + + + + + diff --git a/resources/src/idea/RichPlatformActions.xml b/resources/src/idea/RichPlatformActions.xml index 687b4dc8f830..9ef13f30b2c7 100644 --- a/resources/src/idea/RichPlatformActions.xml +++ b/resources/src/idea/RichPlatformActions.xml @@ -396,6 +396,14 @@ + + + + + + + +