public JBEditorTabs(@Nullable Project project, @NotNull ActionManager actionManager, IdeFocusManager focusManager, @NotNull Disposable parent) { super(project, actionManager, focusManager, parent); Registry.get(TABS_ALPHABETICAL_KEY).addListener(new RegistryValueListener.Adapter() { @Override public void afterValueChanged(RegistryValue value) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { resetTabsCache(); relayout(true, false); } }); } }, parent); }
@Override public void initComponent() { 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(); }
public void testLineNumberMapping() { RegistryValue value = Registry.get("decompiler.use.line.mapping"); boolean old = value.asBoolean(); try { value.setValue(true); VirtualFile file = getTestFile("LineNumbers.class"); assertNull(file.getUserData(LineNumbersMapping.LINE_NUMBERS_MAPPING_KEY)); new IdeaDecompiler().getText(file); LineNumbersMapping mapping = file.getUserData(LineNumbersMapping.LINE_NUMBERS_MAPPING_KEY); assertNotNull(mapping); assertEquals(11, mapping.bytecodeToSource(3)); assertEquals(23, mapping.bytecodeToSource(13)); } finally { value.setValue(old); } }
@Override public final void projectOpened() { Registry.get(REGISTRY_KEY).addListener(new RegistryValueListener.Adapter() { @Override public void afterValueChanged(final RegistryValue value) { myEnabled.set(value.asBoolean()); if (myEnabled.get()) { doEnable(); } } }, myProject); myEnabled = new AtomicBoolean(Registry.is(REGISTRY_KEY) || ApplicationManager.getApplication().isUnitTestMode()); if (myEnabled.get()) { doEnable(); } }
@Nonnull private static SimpleModificationTracker wrapped(RegistryValue value, SimpleModificationTracker fallback, boolean testMode) { if (testMode) { return new SimpleModificationTracker(); } return new SimpleModificationTracker() { @Override public long getModificationCount() { return value.asBoolean() ? super.getModificationCount() : fallback.getModificationCount(); } @Override public void incModificationCount() { if (value.asBoolean()) super.incModificationCount(); //else fallback.incModificationCount(); } }; }
public void afterValueChanged(RegistryValue value) { if (value.asBoolean()) { ourConnection = app.getMessageBus().connect(); ourConnection.subscribe(ApplicationActivationListener.TOPIC, LISTENER); } else { ourConnection.disconnect(); } }
@Override protected void setUp() throws Exception { super.setUp(); myMessageDigest = BytecodeAnalysisConverter.getMessageDigest(); RegistryValue registryValue = Registry.get(ProjectBytecodeAnalysis.NULLABLE_METHOD); nullableMethodRegistryValue = registryValue.asBoolean(); registryValue.setValue(true); }
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); }
public QuickAccessSettings() { myModifiersValue = Registry.get("actionSystem.quickAccessModifiers"); myModifiersValue.addListener(new RegistryValueListener.Adapter() { @Override public void afterValueChanged(RegistryValue value) { applyModifiersFromRegistry(); } }, ApplicationManager.getApplication()); applyModifiersFromRegistry(); }
@Override public void update(@NotNull AnActionEvent e) { if (e.getProject() == null) { e.getPresentation().setEnabled(false); return; } RegistryValue value = Registry.get(key); boolean selected = value.asBoolean(); e.getPresentation().setText((selected ? "Exit" : "Enter") + " Distraction Free Mode"); }
@Override public void actionPerformed(@NotNull AnActionEvent e) { Project project = e.getProject(); RegistryValue value = Registry.get(key); boolean enter = !value.asBoolean(); value.setValue(enter); if (project == null) return; PropertiesComponent p = PropertiesComponent.getInstance(); UISettings ui = UISettings.getInstance(); EditorSettingsExternalizable.OptionSet eo = EditorSettingsExternalizable.getInstance().getOptions(); DaemonCodeAnalyzerSettings ds = DaemonCodeAnalyzerSettings.getInstance(); String before = "BEFORE.DISTRACTION.MODE."; String after = "AFTER.DISTRACTION.MODE."; if (enter) { applyAndSave(p, ui, eo, ds, before, after, false); TogglePresentationModeAction.storeToolWindows(project); } else { applyAndSave(p, ui, eo, ds, after, before, true); TogglePresentationModeAction.restoreToolWindows(project, true, false); } UISettings.getInstance().fireUISettingsChanged(); LafManager.getInstance().updateUI(); EditorUtil.reinitSettings(); DaemonCodeAnalyzer.getInstance(project).settingsChanged(); EditorFactory.getInstance().refreshAllEditors(); }
private static List<BooleanOptionDescription> initValues() { final List<BooleanOptionDescription> result = new ArrayList<BooleanOptionDescription>(); for (RegistryValue value : Registry.getAll()) { if (value.isBoolean()) { final String key = value.getKey(); RegistryBooleanOptionDescriptor optionDescriptor = new RegistryBooleanOptionDescriptor(key, key); if (value.isChangedFromDefault()) { result.add(0, optionDescriptor); } else { result.add(optionDescriptor); } } } return result; }
@TestOnly public static void setShortNotationOfBooleanAttributeIsPreferred(boolean value, Disposable parent) { final boolean oldValue = isShortNotationOfBooleanAttributePreferred(); final RegistryValue registryValue = Registry.get("html.prefer.short.notation.of.boolean.attributes"); registryValue.setValue(value); Disposer.register(parent, new Disposable() { @Override public void dispose() { registryValue.setValue(oldValue); } }); }
public SvnExecutableChecker(@NotNull SvnVcs vcs) { super(vcs.getProject(), getNotificationTitle(), getWrongPathMessage()); myVcs = vcs; Registry.get(SVN_EXECUTABLE_LOCALE_REGISTRY_KEY).addListener(new RegistryValueListener.Adapter() { @Override public void afterValueChanged(@NotNull RegistryValue value) { myVcs.checkCommandLineVersion(); } }, myProject); }
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 static boolean getUpToDateTelemetryEnabled(@NotNull final Consumer<Boolean> consumer, @NotNull Disposable disposable) { final RegistryValue registryValue = Registry.get("inspectionGadgets.telemetry.enabled"); registryValue.addListener(new RegistryValueListener.Adapter() { @Override public void afterValueChanged(RegistryValue value) { consumer.consume(Boolean.valueOf(value.asBoolean())); } }, disposable); return registryValue.asBoolean(); }
public RegistryCheckBox(RegistryValue value) { this(value, value.getDescription(), null); }
public RegistryCheckBox(RegistryValue value, String text, @Nullable String longDescription) { super(new JCheckBox(text), longDescription); myValue = value; getCheckBox().setSelected(myValue.asBoolean()); }
public void testWorkingDirsFileWhenConfigurationSpansToMultipleModules() throws Exception { final Module mod1 = setupModule("mod1", "T1"); final Module mod2 = setupModule("mod2", "T2"); final JUnitConfiguration configuration = new JUnitConfiguration("p", getProject(), JUnitConfigurationType.getInstance().getConfigurationFactories()[0]); configuration.setWorkingDirectory("$MODULE_DIR$"); final JUnitConfiguration.Data persistentData = configuration.getPersistentData(); persistentData.setScope(TestSearchScope.SINGLE_MODULE); configuration.setModule(mod1); persistentData.PACKAGE_NAME = "p"; persistentData.TEST_OBJECT = JUnitConfiguration.TEST_PACKAGE; final ExecutionEnvironment environment = ExecutionEnvironmentBuilder.create(DefaultRunExecutor.getRunExecutorInstance(), configuration).build(); final TestPackage aPackage = new TestPackage(configuration, environment) { @Override protected boolean createTempFiles() { return true; } }; //ensure no fork if single module is selected aPackage.createSearchingForTestsTask().startSearch(); File workingDirsFile = aPackage.getWorkingDirsFile(); assertNotNull(workingDirsFile); assertEmpty(FileUtil.loadFile(workingDirsFile)); //ensure fork when whole project is used persistentData.setScope(TestSearchScope.WHOLE_PROJECT); final RegistryValue smRunnerProperty = Registry.get("junit_sm"); final boolean oldValue = smRunnerProperty.asBoolean(); try { //check old format smRunnerProperty.setValue(false); aPackage.createSearchingForTestsTask().startSearch(); workingDirsFile = aPackage.getWorkingDirsFile(); assertNotNull(workingDirsFile); String file = preparePathsForComparison(FileUtil.loadFile(workingDirsFile), mod1, mod2); assertEquals("p\n" + "MODULE_1\n" + "mod1\n" + "IDEA_HOME/lib/junit-4.12.jar;IDEA_HOME/java/mockJDK-1.8/jre/lib/annotations.jar;IDEA_HOME/java/mockJDK-1.8/jre/lib/rt.jar\n" + "1\n" + "p.T1\n" + "MODULE_2\n" + "mod2\n" + "IDEA_HOME/lib/junit-4.12.jar;IDEA_HOME/java/mockJDK-1.8/jre/lib/annotations.jar;IDEA_HOME/java/mockJDK-1.8/jre/lib/rt.jar\n" + "1\n" + "p.T2\n", file); //check sm runner smRunnerProperty.setValue(true); aPackage.createSearchingForTestsTask().startSearch(); workingDirsFile = aPackage.getWorkingDirsFile(); assertNotNull(workingDirsFile); file = preparePathsForComparison(FileUtil.loadFile(workingDirsFile), mod1, mod2); assertEquals("p\n" + "MODULE_1\n" + "mod1\n" + "IDEA_HOME/lib/junit-4.12.jar;IDEA_HOME/java/mockJDK-1.8/jre/lib/annotations.jar;IDEA_HOME/java/mockJDK-1.8/jre/lib/rt.jar\n" + "1\n" + "p.T1\n" + "MODULE_2\n" + "mod2\n" + "IDEA_HOME/lib/junit-4.12.jar;IDEA_HOME/java/mockJDK-1.8/jre/lib/annotations.jar;IDEA_HOME/java/mockJDK-1.8/jre/lib/rt.jar\n" + "1\n" + "p.T2\n", file); } finally { smRunnerProperty.setValue(oldValue); } }