diff --git a/platform/platform-api/src/com/intellij/ide/SimpleSettingsProvider.java b/platform/platform-api/src/com/intellij/ide/SimpleSettingsProvider.java new file mode 100644 index 000000000000..a7d2eb30b047 --- /dev/null +++ b/platform/platform-api/src/com/intellij/ide/SimpleSettingsProvider.java @@ -0,0 +1,30 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ide; + +import com.intellij.ide.ui.search.BooleanOptionDescription; +import com.intellij.util.Consumer; + +/** + * @author Konstantin Bulenkov + */ +public interface SimpleSettingsProvider { + + + void addSettings(Consumer collector); + + boolean matches(String pattern, BooleanOptionDescription option); +} diff --git a/platform/platform-api/src/com/intellij/ide/ui/UISettingsOptionDescription.java b/platform/platform-api/src/com/intellij/ide/ui/UISettingsOptionDescription.java new file mode 100644 index 000000000000..36777a82157e --- /dev/null +++ b/platform/platform-api/src/com/intellij/ide/ui/UISettingsOptionDescription.java @@ -0,0 +1,60 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ide.ui; + +import com.intellij.ide.ui.search.BooleanOptionDescription; + +import java.lang.reflect.Field; + +/** + * @author Konstantin Bulenkov + */ +public class UISettingsOptionDescription extends BooleanOptionDescription { + private final String myFieldName; + + public UISettingsOptionDescription(String fieldName, String option, String configurableId) { + super(option, configurableId); + myFieldName = fieldName; + } + + @Override + public boolean isOptionEnabled() { + try { + final Field field = UISettings.class.getField(myFieldName); + return field.getBoolean(UISettings.getInstance()); + } + catch (NoSuchFieldException ignore) { + } + catch (IllegalAccessException ignore) { + } + return false; + } + + @Override + public void setOptionState(boolean enabled) { + try { + final Field field = UISettings.class.getField(myFieldName); + field.setBoolean(UISettings.getInstance(), enabled); + } + catch (NoSuchFieldException ignore) { + } + catch (IllegalAccessException ignore) { + } + UISettings.getInstance().fireUISettingsChanged(); + } + + +} diff --git a/platform/platform-api/src/com/intellij/ide/ui/UISimpleSettingsProvider.java b/platform/platform-api/src/com/intellij/ide/ui/UISimpleSettingsProvider.java new file mode 100644 index 000000000000..38fe94bb028b --- /dev/null +++ b/platform/platform-api/src/com/intellij/ide/ui/UISimpleSettingsProvider.java @@ -0,0 +1,32 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ide.ui; + +import com.intellij.ide.SearchTopHitProvider; +import com.intellij.util.Consumer; + +/** + * @author Konstantin Bulenkov + */ +public class UISimpleSettingsProvider implements SearchTopHitProvider { + private static UISettingsOptionDescription CYCLING_SCROLLING = new UISettingsOptionDescription("CYCLING_SCROLLING", "Cyclic scrolling", "appearance"); + + + @Override + public void consumeTopHits(String pattern, Consumer collector) { + + } +} diff --git a/platform/platform-api/src/com/intellij/ide/ui/search/BooleanOptionDescription.java b/platform/platform-api/src/com/intellij/ide/ui/search/BooleanOptionDescription.java new file mode 100644 index 000000000000..9766507f0550 --- /dev/null +++ b/platform/platform-api/src/com/intellij/ide/ui/search/BooleanOptionDescription.java @@ -0,0 +1,29 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ide.ui.search; + +/** + * @author Konstantin Bulenkov + */ +public abstract class BooleanOptionDescription extends OptionDescription { + public BooleanOptionDescription(String option, String configurableId) { + super(option, configurableId, null, null); + } + + public abstract boolean isOptionEnabled(); + + public abstract void setOptionState(boolean enabled); +}