mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-19061 Integrate the Rearranger-plugin into core-IDE
Context menu for matching rules editing
This commit is contained in:
+2
-2
@@ -29,8 +29,8 @@ public class ArrangementConstants {
|
||||
|
||||
public static final DataKey<ArrangementMatchingRulesControl> MATCHING_RULES_CONTROL_KEY = DataKey.create("Arrangement.RuleEditor");
|
||||
|
||||
@NonNls public static final String ACTION_GROUP_RULE_EDITOR_CONTEXT_MENU = "Arrangement.RuleEditor.Context.Menu";
|
||||
@NonNls public static final String ACTION_GROUP_MATCHING_RULES_CONTROL_TOOLBAR = "Arrangement.RuleEditor.ToolBar";
|
||||
@NonNls public static final String ACTION_GROUP_MATCHING_RULES_CONTEXT_MENU = "Arrangement.Rule.Match.Control.Context.Menu";
|
||||
@NonNls public static final String ACTION_GROUP_MATCHING_RULES_CONTROL_TOOLBAR = "Arrangement.Rule.Match.Control.ToolBar";
|
||||
|
||||
@NonNls public static final String RULE_EDITOR_PLACE = "Arrangement.RuleEditor.Place";
|
||||
@NonNls public static final String MATCHING_RULES_CONTROL_TOOLBAR_PLACE = "Arrangement.Rule.Match.Control.ToolBar.Place";
|
||||
|
||||
+19
-2
@@ -15,11 +15,14 @@
|
||||
*/
|
||||
package com.intellij.application.options.codeStyle.arrangement.action;
|
||||
|
||||
import com.intellij.application.options.codeStyle.arrangement.ArrangementConstants;
|
||||
import com.intellij.application.options.codeStyle.arrangement.match.ArrangementMatchingRulesControl;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Toggleable;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import gnu.trove.TIntArrayList;
|
||||
|
||||
/**
|
||||
* @author Denis Zhdanov
|
||||
@@ -31,9 +34,23 @@ public class EditArrangementRuleAction extends AnAction implements DumbAware, To
|
||||
getTemplatePresentation().setText(ApplicationBundle.message("arrangement.action.rule.edit.text"));
|
||||
getTemplatePresentation().setDescription(ApplicationBundle.message("arrangement.action.rule.edit.description"));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
ArrangementMatchingRulesControl control = ArrangementConstants.MATCHING_RULES_CONTROL_KEY.getData(e.getDataContext());
|
||||
e.getPresentation().setEnabled(control != null && control.getSelectedModelRows().size() == 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
// TODO den implement
|
||||
ArrangementMatchingRulesControl control = ArrangementConstants.MATCHING_RULES_CONTROL_KEY.getData(e.getDataContext());
|
||||
if (control == null) {
|
||||
return;
|
||||
}
|
||||
TIntArrayList rows = control.getSelectedModelRows();
|
||||
if (rows.size() != 1) {
|
||||
return;
|
||||
}
|
||||
control.showEditor(rows.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -19,6 +19,7 @@ import com.intellij.application.options.codeStyle.arrangement.ArrangementConstan
|
||||
import com.intellij.application.options.codeStyle.arrangement.ArrangementNodeDisplayManager;
|
||||
import com.intellij.application.options.codeStyle.arrangement.color.ArrangementColorsProvider;
|
||||
import com.intellij.application.options.codeStyle.arrangement.util.TitleWithToolbar;
|
||||
import com.intellij.ide.ui.customization.CustomizationUtil;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.StdArrangementMatchRule;
|
||||
@@ -70,6 +71,9 @@ public class ArrangementMatchingRulesPanel extends JPanel implements DataProvide
|
||||
};
|
||||
myControl = new ArrangementMatchingRulesControl(displayManager, colorsProvider, settingsFilter, callback);
|
||||
scrollPane.setViewportView(myControl);
|
||||
CustomizationUtil.installPopupHandler(
|
||||
myControl, ArrangementConstants.ACTION_GROUP_MATCHING_RULES_CONTEXT_MENU, ArrangementConstants.RULE_EDITOR_PLACE
|
||||
);
|
||||
|
||||
TitleWithToolbar top = new TitleWithToolbar(
|
||||
ApplicationBundle.message("arrangement.settings.section.match"),
|
||||
|
||||
@@ -561,8 +561,8 @@ arrangement.text.modifier=Modifier
|
||||
arrangement.text.negate=Negate
|
||||
arrangement.action.rule.add.text=Add rule
|
||||
arrangement.action.rule.add.description=Add new arrangement rule
|
||||
arrangement.action.rule.remove.text=Remove rule
|
||||
arrangement.action.rule.remove.description=Remove selected arrangement rule
|
||||
arrangement.action.rule.remove.text=Remove rule(s)
|
||||
arrangement.action.rule.remove.description=Remove selected arrangement rule(s)
|
||||
arrangement.action.rule.edit.text=Edit rule
|
||||
arrangement.action.rule.edit.description=Edit selected arrangement rule
|
||||
arrangement.action.rule.move.up.text=Move up
|
||||
|
||||
@@ -828,13 +828,13 @@
|
||||
class="com.intellij.application.options.codeStyle.arrangement.action.MoveArrangementRuleDownAction"
|
||||
icon="AllIcons.ToolbarDecorator.MoveDown"/>
|
||||
|
||||
<group id="Arrangement.RuleEditor.Context.Menu">
|
||||
<group id="Arrangement.Rule.Match.Control.Context.Menu">
|
||||
<reference ref="Arrangement.Rule.Add"/>
|
||||
<reference ref="Arrangement.Rule.Remove"/>
|
||||
<reference ref="Arrangement.Rule.Edit"/>
|
||||
</group>
|
||||
|
||||
<group id="Arrangement.RuleEditor.ToolBar">
|
||||
<group id="Arrangement.Rule.Match.Control.ToolBar">
|
||||
<reference ref="Arrangement.Rule.Add"/>
|
||||
<reference ref="Arrangement.Rule.Remove"/>
|
||||
<reference ref="Arrangement.Rule.Move.Up"/>
|
||||
|
||||
Reference in New Issue
Block a user