Customizable Configure items.

This commit is contained in:
Maxim Shafirov
2012-11-16 21:29:42 +04:00
parent 0005f9158e
commit d5e4cfb8ca
10 changed files with 104 additions and 44 deletions
@@ -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";
@@ -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);
}
}
@@ -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);
}
}
@@ -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
@@ -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!!!");
}
}
}
@@ -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);
@@ -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.*;
@@ -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
@@ -462,6 +462,16 @@
<reference ref="Help.KeymapReference"/>
</group>
<group id="WelcomeScreen.Configure">
<!-- TODO: Bigger icon for settings -->
<action id="WelcomeScreen.Settings" class="com.intellij.ide.actions.ShowSettingsAction" icon="AllIcons.General.Settings"/>
<action id="WelcomeScreen.Plugins" class="com.intellij.ide.actions.ShowPluginManagerAction" icon="AllIcons.General.PluginManager"/>
<!-- TODO: Actions -->
<action id="WelcomeScreen.Configure.Import" class="com.intellij.ide.actions.ImportSettingsAction"/>
<action id="WelcomeScreen.Configure.Export" class="com.intellij.ide.actions.ExportSettingsAction"/>
</group>
<group id="FileChooser">
<action id="FileChooser.TogglePathShowing" class="com.intellij.openapi.fileChooser.actions.TooglePathShowingAction"/>
</group>
@@ -396,6 +396,14 @@
<add-to-group group-id="WelcomeScreen.Documentation" anchor="last"/>
</group>
<group id="WelcomeScreen.Configure.IDEA">
<!-- TODO: Icons -->
<action id="WelcomeScreen.Configure.Template_Project_Settings" class="com.intellij.ide.actions.TemplateProjectPropertiesAction"/>
<action id="WelcomeScreen.Configure.Template_Project_Structure" class="com.intellij.ide.actions.TemplateProjectStructureAction"/>
<add-to-group group-id="WelcomeScreen.Configure" anchor="last"/>
</group>
<action id="AddFrameworkSupport" class="com.intellij.ide.util.frameworkSupport.AddFrameworkSupportAction">
<add-to-group group-id="ProjectViewPopupMenu" anchor="after" relative-to-action="WeighingNewGroup"/>
<add-to-group group-id="NavbarPopupMenu" anchor="after" relative-to-action="WeighingNewGroup"/>