diff --git a/platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurable.java b/platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurable.java index e3157d5626c0..eec2fe76fa7f 100644 --- a/platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurable.java +++ b/platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurable.java @@ -44,7 +44,7 @@ import java.awt.*; import java.nio.charset.Charset; import java.util.Map; -public class FileEncodingConfigurable implements SearchableConfigurable, OptionalConfigurable, Configurable.NoScroll { +public class FileEncodingConfigurable implements SearchableConfigurable, Configurable.NoScroll { private final Project myProject; private EncodingFileTreeTable myTreeView; private JScrollPane myTreePanel; @@ -205,10 +205,4 @@ public class FileEncodingConfigurable implements SearchableConfigurable, Optiona private void createUIComponents() { myTreePanel = ScrollPaneFactory.createScrollPane(new JBTable()); } - - @Override - public boolean needDisplay() { - // TODO[yole] cleaner API - return !PlatformUtils.isRubyMine(); - } } diff --git a/platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurableProvider.java b/platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurableProvider.java new file mode 100644 index 000000000000..86fb891e249c --- /dev/null +++ b/platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurableProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2000-2014 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.openapi.vfs.encoding; + +import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.ConfigurableProvider; +import com.intellij.openapi.project.Project; +import com.intellij.util.PlatformUtils; + +/** + * @author Sergey.Malenkov + */ +public final class FileEncodingConfigurableProvider extends ConfigurableProvider { + private final Project myProject; + + public FileEncodingConfigurableProvider(Project project) { + myProject = project; + } + + @Override + public boolean canCreateConfigurable() { + return !PlatformUtils.isRubyMine(); + } + + @Override + public Configurable createConfigurable() { + return new FileEncodingConfigurable(myProject); + } +} diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurable.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurable.java index 038bb08bda1d..87f65fe3268e 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurable.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurable.java @@ -29,7 +29,7 @@ import javax.swing.*; /** * @author spleaner */ -public class NotificationsConfigurable implements Configurable, SearchableConfigurable, OptionalConfigurable, Configurable.NoScroll { +public class NotificationsConfigurable implements Configurable, SearchableConfigurable, Configurable.NoScroll { public static final String DISPLAY_NAME = "Notifications"; private NotificationsConfigurablePanel myComponent; @@ -85,9 +85,4 @@ public class NotificationsConfigurable implements Configurable, SearchableConfig public Runnable enableSearch(final String option) { return null; } - - @Override - public boolean needDisplay() { - return NotificationsConfigurationImpl.getInstanceImpl().getAllSettings().length > 0; - } } diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurableProvider.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurableProvider.java new file mode 100644 index 000000000000..947374bc3b2b --- /dev/null +++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurableProvider.java @@ -0,0 +1,34 @@ +/* + * Copyright 2000-2014 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.notification.impl; + +import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.ConfigurableProvider; + +/** + * @author Sergey.Malenkov + */ +public final class NotificationsConfigurableProvider extends ConfigurableProvider { + @Override + public boolean canCreateConfigurable() { + return NotificationsConfigurationImpl.getInstanceImpl().getAllSettings().length > 0; + } + + @Override + public Configurable createConfigurable() { + return new NotificationsConfigurable(); + } +} diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index 6cb7665bac8f..f6dfa2d63a3d 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -737,7 +737,12 @@ - + diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml index fafca82c9ffc..ead98f304b65 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml @@ -231,7 +231,11 @@ key="title.customizations" bundle="messages.IdeBundle"/> - + - + diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java index 8c2fc88939de..44e639a70415 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java @@ -30,7 +30,7 @@ import java.util.Set; /** * @author nik */ -public class RemoteServerListConfigurable extends MasterDetailsComponent implements OptionalConfigurable, SearchableConfigurable { +public class RemoteServerListConfigurable extends MasterDetailsComponent implements SearchableConfigurable { private final RemoteServersManager myServersManager; @Nullable private final ServerType myServerType; private RemoteServer myLastSelectedServer; @@ -138,11 +138,6 @@ public class RemoteServerListConfigurable extends MasterDetailsComponent impleme return actions; } - @Override - public boolean needDisplay() { - return ServerType.EP_NAME.getExtensions().length > 0; - } - @Override protected boolean wasObjectStored(Object editableObject) { return true; diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurableProvider.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurableProvider.java new file mode 100644 index 000000000000..9375949f713c --- /dev/null +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurableProvider.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 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.remoteServer.impl.configuration; + +import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.ConfigurableProvider; +import com.intellij.remoteServer.ServerType; +import com.intellij.remoteServer.configuration.RemoteServersManager; + +/** + * @author Sergey.Malenkov + */ +public final class RemoteServerListConfigurableProvider extends ConfigurableProvider { + @Override + public boolean canCreateConfigurable() { + return ServerType.EP_NAME.getExtensions().length > 0; + } + + @Override + public Configurable createConfigurable() { + return new RemoteServerListConfigurable(RemoteServersManager.getInstance()); + } +} diff --git a/python/ide/src/com/jetbrains/python/configuration/PyDependenciesConfigurable.java b/python/ide/src/com/jetbrains/python/configuration/PyDependenciesConfigurable.java index 8b2d7ca30188..5054f2b743e0 100644 --- a/python/ide/src/com/jetbrains/python/configuration/PyDependenciesConfigurable.java +++ b/python/ide/src/com/jetbrains/python/configuration/PyDependenciesConfigurable.java @@ -17,8 +17,6 @@ package com.jetbrains.python.configuration; import com.intellij.application.options.ModuleAwareProjectConfigurable; import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.options.OptionalConfigurable; import com.intellij.openapi.options.UnnamedConfigurable; import com.intellij.openapi.project.Project; import org.jetbrains.annotations.NotNull; @@ -26,12 +24,9 @@ import org.jetbrains.annotations.NotNull; /** * @author yole */ -public class PyDependenciesConfigurable extends ModuleAwareProjectConfigurable implements OptionalConfigurable { - private final Project myProject; - +public class PyDependenciesConfigurable extends ModuleAwareProjectConfigurable { public PyDependenciesConfigurable(Project project) { super(project, "Project Dependencies", "reference.settingsdialog.project.dependencies"); - myProject = project; } @NotNull @@ -39,9 +34,4 @@ public class PyDependenciesConfigurable extends ModuleAwareProjectConfigurable i protected UnnamedConfigurable createModuleConfigurable(Module module) { return new PyModuleDependenciesConfigurable(module); } - - @Override - public boolean needDisplay() { - return ModuleManager.getInstance(myProject).getModules().length > 1; - } } diff --git a/python/ide/src/com/jetbrains/python/configuration/PyDependenciesConfigurableProvider.java b/python/ide/src/com/jetbrains/python/configuration/PyDependenciesConfigurableProvider.java new file mode 100644 index 000000000000..434b0425f04a --- /dev/null +++ b/python/ide/src/com/jetbrains/python/configuration/PyDependenciesConfigurableProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2000-2014 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.jetbrains.python.configuration; + +import com.intellij.openapi.module.ModuleManager; +import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.ConfigurableProvider; +import com.intellij.openapi.project.Project; + +/** + * @author Sergey.Malenkov + */ +public final class PyDependenciesConfigurableProvider extends ConfigurableProvider { + private final Project myProject; + + public PyDependenciesConfigurableProvider(Project project) { + myProject = project; + } + + @Override + public boolean canCreateConfigurable() { + return ModuleManager.getInstance(myProject).getModules().length > 1; + } + + @Override + public Configurable createConfigurable() { + return new PyDependenciesConfigurable(myProject); + } +} diff --git a/python/ide/src/com/jetbrains/python/configuration/PythonContentEntriesConfigurable.java b/python/ide/src/com/jetbrains/python/configuration/PythonContentEntriesConfigurable.java index 1d1c134dbe0f..9d7794ab604c 100644 --- a/python/ide/src/com/jetbrains/python/configuration/PythonContentEntriesConfigurable.java +++ b/python/ide/src/com/jetbrains/python/configuration/PythonContentEntriesConfigurable.java @@ -17,37 +17,20 @@ package com.jetbrains.python.configuration; import com.intellij.application.options.ModuleAwareProjectConfigurable; import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.NonDefaultProjectConfigurable; -import com.intellij.openapi.options.OptionalConfigurable; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ui.configuration.PlatformContentEntriesConfigurable; -import com.intellij.util.ArrayUtil; import com.intellij.util.PlatformUtils; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.model.java.JavaSourceRootType; /** * @author yole */ -public class PythonContentEntriesConfigurable extends ModuleAwareProjectConfigurable implements NonDefaultProjectConfigurable, OptionalConfigurable { - private final Project myProject; - +public class PythonContentEntriesConfigurable extends ModuleAwareProjectConfigurable implements NonDefaultProjectConfigurable { public PythonContentEntriesConfigurable(final Project project) { super(project, "Project Structure", "reference.settingsdialog.project.structure"); - myProject = project; - } - - @Nullable - private static Module getSingleModule(Project project) { - return ArrayUtil.getFirstElement(ModuleManager.getInstance(project).getModules()); - } - - @Override - public boolean needDisplay() { - return getSingleModule(myProject) != null; } @NotNull diff --git a/python/ide/src/com/jetbrains/python/configuration/PythonContentEntriesConfigurableProvider.java b/python/ide/src/com/jetbrains/python/configuration/PythonContentEntriesConfigurableProvider.java new file mode 100644 index 000000000000..3b85bee1e139 --- /dev/null +++ b/python/ide/src/com/jetbrains/python/configuration/PythonContentEntriesConfigurableProvider.java @@ -0,0 +1,43 @@ +/* + * Copyright 2000-2014 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.jetbrains.python.configuration; + +import com.intellij.openapi.module.ModuleManager; +import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.ConfigurableProvider; +import com.intellij.openapi.project.Project; +import com.intellij.util.ArrayUtil; + +/** + * @author Sergey.Malenkov + */ +public final class PythonContentEntriesConfigurableProvider extends ConfigurableProvider { + private final Project myProject; + + public PythonContentEntriesConfigurableProvider(Project project) { + myProject = project; + } + + @Override + public boolean canCreateConfigurable() { + return ArrayUtil.getFirstElement(ModuleManager.getInstance(myProject).getModules()) != null; + } + + @Override + public Configurable createConfigurable() { + return new PythonContentEntriesConfigurable(myProject); + } +} diff --git a/python/src/META-INF/pycharm-core.xml b/python/src/META-INF/pycharm-core.xml index 78e0e89099b2..6b53fa20388b 100644 --- a/python/src/META-INF/pycharm-core.xml +++ b/python/src/META-INF/pycharm-core.xml @@ -40,7 +40,7 @@ + provider="com.jetbrains.python.configuration.PythonContentEntriesConfigurableProvider"/> + provider="com.jetbrains.python.configuration.PyDependenciesConfigurableProvider"/>