IDEA-154988 ui: do not suggest to add icon to an action in "Menus & Toolbars" settings

After d54427aea8 we will replace missing
icon on toolbar with an AllIcons.Toolbar.Unknown automatically,
so there is no need to force modification of global presentation.
This commit is contained in:
Aleksey Pivovarov
2018-05-16 15:35:27 +03:00
parent 08991959df
commit bdaa4ec345
2 changed files with 0 additions and 44 deletions
@@ -151,7 +151,6 @@ public class CustomizableActionsPanel {
if (o instanceof String) {
DefaultMutableTreeNode current = new DefaultMutableTreeNode(url.getComponent());
current.setParent((DefaultMutableTreeNode)node.getParent());
editToolbarIcon((String)o, current);
}
}
((DefaultTreeModel)myActionsTree.getModel()).reload();
@@ -317,24 +316,6 @@ public class CustomizableActionsPanel {
myRestoreAllDefaultButton.setEnabled(true);
}
private void editToolbarIcon(String actionId, DefaultMutableTreeNode node) {
final AnAction anAction = ActionManager.getInstance().getAction(actionId);
if (isToolbarAction(node) && anAction.getTemplatePresentation().getIcon() == null) {
final int exitCode = Messages.showOkCancelDialog(IdeBundle.message("error.adding.action.without.icon.to.toolbar"),
IdeBundle.message("title.unable.to.add.action.without.icon.to.toolbar"),
Messages.getInformationIcon());
if (exitCode == Messages.OK) {
mySelectedSchema.addIconCustomization(actionId, null);
anAction.getTemplatePresentation().setIcon(AllIcons.Toolbar.Unknown);
anAction.getTemplatePresentation().setDisabledIcon(IconLoader.getDisabledIcon(AllIcons.Toolbar.Unknown));
anAction.setDefaultIcon(false);
node.setUserObject(Pair.create(actionId, AllIcons.Toolbar.Unknown));
myActionsTree.repaint();
CustomActionsSchema.setCustomizationSchemaForCurrentProjects();
}
}
}
private void setButtonsDisabled() {
myRemoveActionButton.setEnabled(false);
myAddActionButton.setEnabled(false);
@@ -506,26 +487,6 @@ public class CustomizableActionsPanel {
}
}
private static boolean isToolbarAction(DefaultMutableTreeNode node) {
TreeNode parent = node.getParent();
while (parent != null) {
if (parent instanceof DefaultMutableTreeNode) {
Object userObject = ((DefaultMutableTreeNode)parent).getUserObject();
if (userObject instanceof Group) {
Group group = (Group)userObject;
String groupName = group.getName();
if (groupName.toLowerCase(Locale.ENGLISH).contains("toolbar")) return true;
String groupId = group.getId();
if (groupId != null && groupId.toLowerCase(Locale.ENGLISH).contains("toolbar")) return true;
}
}
parent = parent.getParent();
}
return false;
}
@Nullable
private static String getActionId(DefaultMutableTreeNode node) {
return (String)(node.getUserObject() instanceof String ? node.getUserObject() :
@@ -568,7 +529,6 @@ public class CustomizableActionsPanel {
mySelectedSchema.removeIconCustomization(actionId);
final DefaultMutableTreeNode nodeOnToolbar = findNodeOnToolbar(actionId);
if (nodeOnToolbar != null){
editToolbarIcon(actionId, nodeOnToolbar);
node.setUserObject(nodeOnToolbar.getUserObject());
}
}
@@ -641,7 +601,6 @@ public class CustomizableActionsPanel {
final Icon icon = (Icon)((Pair)userObject).second;
action.getTemplatePresentation().setIcon(icon);
action.setDefaultIcon(icon == null);
editToolbarIcon(actionId, myNode);
}
myActionsTree.repaint();
}
@@ -746,7 +705,6 @@ public class CustomizableActionsPanel {
Icon icon = (Icon)((Pair)userObject).second;
action.getTemplatePresentation().setIcon(icon);
action.setDefaultIcon(icon == null);
editToolbarIcon(actionId, mutableNode);
}
}
return true;
@@ -709,8 +709,6 @@ idea.default.look.and.feel=IDEA (4.5 default)
idea.intellij.look.and.feel=IntelliJ
idea.dark.look.and.feel=Darcula
error.cannot.set.look.and.feel=<html><body>Cannot set {0} theme:<br>{1}</body></html>
error.adding.action.without.icon.to.toolbar=You are adding an action without icon to the toolbar. The default icon will be added to this action.
title.unable.to.add.action.without.icon.to.toolbar=Unable to Add Action Without Icon to the Toolbar
error.please.specify.new.name.for.schema=Please, specify new name for scheme ''{0}''.
title.browse.icon=Browse Icon
prompt.browse.icon.for.selected.action=Browse icon for selected action (*.png)