MacBook touch bar: customize touchbar actions for DataGrip

This commit is contained in:
Artem Bochkarev
2018-07-18 15:26:45 +07:00
parent 3644644ce3
commit 031a9685e1
3 changed files with 8 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.IconLoader;
import com.intellij.ui.mac.foundation.ID;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -130,6 +131,8 @@ class TBItemAnActionButton extends TBItemButton {
if (myAnAction instanceof Toggleable) {
final Object selectedProp = presentation.getClientProperty(Toggleable.SELECTED_PROPERTY);
isSelected = selectedProp != null && selectedProp == Boolean.TRUE;
if (myNativePeer != ID.NIL && myActionId != null && myActionId.startsWith("Console.Jdbc.Execute")) // permanent update of toggleable-buttons of DataGrip
myUpdateOptions |= NSTLibrary.BUTTON_UPDATE_FLAGS;
}
if ("RunConfiguration".equals(myActionId)) {
if (presentation.getIcon() != AllIcons.General.Add) {

View File

@@ -18,12 +18,11 @@ class TBItemButton extends TBItem {
protected int myLayoutBits = 0;
protected int myFlags = 0;
protected boolean myHasArrowIcon = false;
protected int myUpdateOptions;
private @Nullable Runnable myAction;
private @Nullable NSTLibrary.Action myNativeCallback;
private int myUpdateOptions;
TBItemButton(@NotNull String uid, @Nullable ItemListener listener) { super(uid, listener); }
TBItemButton setIcon(Icon icon) {

View File

@@ -1103,11 +1103,11 @@
<group id="TouchBar">
<group id="TouchBarDefault" text="Default">
<reference ref="RunConfiguration"/>
<group id="RunnerActionsTouchbar"/> <!--filled from ExecutorRegistry-->
<group id="RunnerActionsTouchbar" text="Touchbar Run/Debug Actions"/> <!--filled from ExecutorRegistry-->
<reference ref="Stop"/>
<separator text="type.small"/>
<separator text="type.large"/>
<group id="TouchBarDefaultOptionalGroup">
<group id="TouchBarDefaultOptionalGroup" text="Optional Actions">
<reference ref="Vcs.UpdateProject"/>
<reference ref="CheckinProject"/>
</group>
@@ -1147,7 +1147,7 @@
<separator text="type.small"/>
<reference ref="XDebugger.MuteBreakpoints"/>
<separator text="type.flexible"/>
<group id="TouchBarDebug.StepButtons" compact="true">
<group id="TouchBarDebug.StepButtons" compact="true" text="Debugger Step Actions">
<reference ref="StepOver"/>
<reference ref="StepInto"/>
<reference ref="StepOut"/>
@@ -1156,7 +1156,7 @@
<group id="TouchBarDebug_alt" text="Debugger with Alt key">
<reference ref="ViewBreakpoints"/>
<separator text="type.flexible"/>
<group id="TouchBarDebug.ForceStepButtons" compact="true">
<group id="TouchBarDebug.ForceStepButtons" compact="true" text="Debugger ForceStep Actions">
<reference ref="RunToCursor"/>
<reference ref="ForceStepOver"/>
<reference ref="ForceStepInto"/>