Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #312 Editor: Toggle Highlight of All Occurrences, made two sepa… #313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@

## [Unreleased]

## [13.3.0-IJ2023.3] - 2024-11-13
- Editor: Toggle Highlight of All Occurrences (Case sensitive) - made case sensitive
- Editor: Toggle Highlight of All Occurrences (Case insensitive) - made case insensitive

## [13.2.0-IJ2023.3] - 2024-11-01
- Editor: Toggle Highlight of All Occurrences - made case insensitive

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ pluginGroup=GrepConsole
pluginName=GrepConsole
pluginRepositoryUrl=https://github.com/krasa/GrepConsole
# SemVer format -> https://semver.org
pluginVersion=13.2.0-IJ2023.3
pluginVersion=13.3.0-IJ2023.3
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild=233
pluginUntilBuild=
Original file line number Diff line number Diff line change
@@ -9,7 +9,11 @@
public class QuickToggleEditorHighlightAction extends ToggleEditorHighlightAction {
private static final Logger LOG = com.intellij.openapi.diagnostic.Logger.getInstance(QuickToggleEditorHighlightAction.class);

@Override
public QuickToggleEditorHighlightAction() {
super(false);
}

@Override
protected Color chooseColor(Editor editor) {
return Utils.nextColor();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package krasa.grepconsole.action;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import krasa.grepconsole.utils.Utils;

import java.awt.*;

public class QuickToggleEditorHighlightCSAction extends ToggleEditorHighlightAction {
private static final Logger LOG = Logger.getInstance(QuickToggleEditorHighlightCSAction.class);

public QuickToggleEditorHighlightCSAction() {
super(true);
}

@Override
protected Color chooseColor(Editor editor) {
return Utils.nextColor();
}
}
Original file line number Diff line number Diff line change
@@ -29,10 +29,16 @@
public class ToggleEditorHighlightAction extends MyDumbAwareAction {
//HighlighterLayer.CONSOLE_FILTER not in IJ 2016
int CONSOLE_FILTER = 5800;

boolean caseSensitive = false;

public ToggleEditorHighlightAction() {
}

public ToggleEditorHighlightAction(boolean caseSensitive) {
this.caseSensitive = caseSensitive;
}


@Override
public void actionPerformed(AnActionEvent e) {
@@ -116,8 +122,12 @@ private void addExpressionItem(String string, Color color, final Profile profile
GrepStyle style = new GrepStyle();
style.setForegroundColor(new GrepColor(Color.BLACK));
style.setBackgroundColor(new GrepColor(color));
GrepExpressionItem item = new GrepExpressionItem().grepExpression(string).caseInsensitive(true).style(style).highlightOnlyMatchingText(
true).operationOnMatch(Operation.CONTINUE_MATCHING);
GrepExpressionItem item = new GrepExpressionItem()
.grepExpression(string)
.caseInsensitive(!caseSensitive)
.style(style)
.highlightOnlyMatchingText(true)
.operationOnMatch(Operation.CONTINUE_MATCHING);

java.util.List<GrepExpressionGroup> grepExpressionGroups = profile.getGrepExpressionGroups();
GrepExpressionGroup group = grepExpressionGroups.get(0);
13 changes: 11 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -90,15 +90,24 @@
<!--<add-to-group group-id="EditorPopupMenu" anchor="first" />-->
</action>

<action id="QuickToggleEditorHighlight" class="krasa.grepconsole.action.QuickToggleEditorHighlightAction"
<action id="QuickToggleEditorHighlight" class="krasa.grepconsole.action.QuickToggleEditorHighlightCSAction"
text="Toggle Highlight of All Occurrences"
icon="/krasa/grepconsole/icons/highlight.svg"
description="Toggle highlight of all occurrences of the selected text in the editor - with predefined colors">
description="Toggle highlight of all occurrences (case sensitive) of the selected text in the editor - with predefined colors">
<add-to-group group-id="GrepConsole.ToolsMenu" anchor="last"/>
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
<keyboard-shortcut keymap="$default" first-keystroke="ctrl alt F3"/>
</action>

<action id="QuickToggleEditorHighlightCS" class="krasa.grepconsole.action.QuickToggleEditorHighlightAction"
text="Toggle Highlight of All Occurrences (Case Insensitive)"
icon="/krasa/grepconsole/icons/highlight.svg"
description="Toggle highlight of all occurrences (case insensitive) of the selected text in the editor - with predefined colors">
<add-to-group group-id="GrepConsole.ToolsMenu" anchor="last"/>
<!--<add-to-group group-id="EditorPopupMenu" anchor="first"/>-->
<keyboard-shortcut keymap="$default" first-keystroke="ctrl alt F4"/>
</action>

<action id="GrepConsole.Highlight" class="krasa.grepconsole.action.EditorHighlightAction"
text="Highlight Editor according to Grep Console settings"
icon="/krasa/grepconsole/icons/highlight.svg"