private boolean isUseSystemLook() { boolean useSystem; if ("default".equalsIgnoreCase(myMode.asString())) { useSystem = true; } else if ("system".equalsIgnoreCase(myMode.asString())) { useSystem = true; } else if ("graphite".equalsIgnoreCase(myMode.asString())) { useSystem = false; } else { useSystem = false; } return useSystem; }
public static boolean isTooltipRequest(KeyEvent keyEvent) { if (ourTooltipKeysProperty == null) { ourTooltipKeysProperty = Registry.get("ide.forcedShowTooltip"); ourTooltipKeysProperty.addListener( new RegistryValueListener.Adapter() { @Override public void afterValueChanged(RegistryValue value) { updateTooltipRequestKey(value); } }, Disposer.get("ui")); updateTooltipRequestKey(ourTooltipKeysProperty); } if (keyEvent.getID() != KeyEvent.KEY_PRESSED) return false; for (Integer each : ourTooltipKeys) { if ((keyEvent.getModifiers() & each.intValue()) == 0) return false; } for (Integer each : ourOtherTooltipKeys) { if ((keyEvent.getModifiers() & each.intValue()) > 0) return false; } final int code = keyEvent.getKeyCode(); return code == KeyEvent.VK_META || code == KeyEvent.VK_CONTROL || code == KeyEvent.VK_SHIFT || code == KeyEvent.VK_ALT; }
@Override public void initComponent() { myMode = Registry.get("ide.tooltip.mode"); myIsEnabled = Registry.get("ide.tooltip.callout"); myIsEnabled.addListener( new RegistryValueListener.Adapter() { @Override public void afterValueChanged(RegistryValue value) { processEnabled(); } }, ApplicationManager.getApplication()); Toolkit.getDefaultToolkit() .addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); ActionManager.getInstance() .addAnActionListener( new AnActionListener.Adapter() { @Override public void beforeActionPerformed( AnAction action, DataContext dataContext, AnActionEvent event) { hideCurrent(null, action, event); } }, ApplicationManager.getApplication()); processEnabled(); }
private void processEnabled() { if (myIsEnabled.asBoolean()) { ToolTipManager.sharedInstance().setEnabled(false); } else { ToolTipManager.sharedInstance().setEnabled(true); } }
private String getModifierRegistryValue() { String value = myModifiersValue.asString().trim(); if (value.length() > 0) return value; if (SystemInfo.isMac) { return "control alt"; } else { return "shift alt"; } }
void saveModifiersToRegistry(Set<String> codeTexts) { StringBuffer value = new StringBuffer(); for (String each : codeTexts) { if (value.length() > 0) { value.append(" "); } value.append(each); } myModifiersValue.setValue(value.toString()); }
private static void updateTooltipRequestKey(RegistryValue value) { final String text = value.asString(); ourTooltipKeys.clear(); ourOtherTooltipKeys.clear(); processKey(text.contains("meta"), InputEvent.META_MASK); processKey(text.contains("control") || text.contains("ctrl"), InputEvent.CTRL_MASK); processKey(text.contains("shift"), InputEvent.SHIFT_MASK); processKey(text.contains("alt"), InputEvent.ALT_MASK); }
@Override public void eventDispatched(AWTEvent event) { if (!myIsEnabled.asBoolean()) return; MouseEvent me = (MouseEvent) event; Component c = me.getComponent(); if (me.getID() == MouseEvent.MOUSE_ENTERED) { boolean canShow = true; if (me.getComponent() != myCurrentComponent) { canShow = hideCurrent(me, null, null); } if (canShow) { maybeShowFor(c, me); } } else if (me.getID() == MouseEvent.MOUSE_EXITED) { if (me.getComponent() == myCurrentComponent || me.getComponent() == myQueuedComponent) { hideCurrent(me, null, null); } } else if (me.getID() == MouseEvent.MOUSE_MOVED) { if (me.getComponent() == myCurrentComponent || me.getComponent() == myQueuedComponent) { if (myCurrentTipUi != null && myCurrentTipUi.wasFadedIn()) { if (hideCurrent(me, null, null)) { maybeShowFor(c, me); } } else { if (!myCurrentTipIsCentered) { myX = me.getX(); myY = me.getY(); if (c instanceof JComponent && ((JComponent) c).getToolTipText(me) == null && (myQueuedTooltip == null || !myQueuedTooltip.isHint())) { hideCurrent( me, null, null); // There is no tooltip or hint here, let's proceed it as MOUSE_EXITED } else { maybeShowFor(c, me); } } } } else if (myCurrentComponent == null && myQueuedComponent == null) { maybeShowFor(c, me); } } else if (me.getID() == MouseEvent.MOUSE_PRESSED) { if (me.getComponent() == myCurrentComponent) { hideCurrent(me, null, null); } } else if (me.getID() == MouseEvent.MOUSE_DRAGGED) { hideCurrent(me, null, null); } }
public void initComponent() { myModifiersValue = Registry.get("actionSystem.quickAccessModifiers"); myModifiersValue.addListener( new RegistryValueListener.Adapter() { public void afterValueChanged(RegistryValue value) { applyModifiersFromRegistry(); } }, this); KeymapManager kmMgr = KeymapManager.getInstance(); kmMgr.addKeymapManagerListener(this); activeKeymapChanged(kmMgr.getActiveKeymap()); applyModifiersFromRegistry(); }
public void save() { myValue.setValue(Boolean.valueOf(getCheckBox().isSelected()).toString()); }
public boolean isChanged() { return getCheckBox().isSelected() != myValue.asBoolean(); }
public RegistryCheckBox(RegistryValue value, String text, @Nullable String longDescription) { super(new JCheckBox(text), longDescription); myValue = value; getCheckBox().setSelected(myValue.asBoolean()); }
public RegistryCheckBox(RegistryValue value) { this(value, value.getDescription(), null); }