/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java

https://bitbucket.org/nbargnesi/idea · Java · 100 lines · 66 code · 16 blank · 18 comment · 12 complexity · 9ada620c5e6b5ade9e44f9c17019f7b7 MD5 · raw file

  1. /*
  2. * Copyright 2000-2009 JetBrains s.r.o.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.intellij.xdebugger.impl.settings;
  17. import com.intellij.openapi.options.Configurable;
  18. import com.intellij.openapi.options.ConfigurationException;
  19. import com.intellij.openapi.options.SearchableConfigurable;
  20. import com.intellij.xdebugger.XDebuggerBundle;
  21. import com.intellij.xdebugger.impl.DebuggerSupport;
  22. import org.jetbrains.annotations.NonNls;
  23. import org.jetbrains.annotations.NotNull;
  24. import javax.swing.*;
  25. import java.util.List;
  26. /**
  27. * @author Eugene Belyaev & Eugene Zhuravlev
  28. */
  29. public class DebuggerConfigurable implements SearchableConfigurable.Parent {
  30. public static final String DISPLAY_NAME = XDebuggerBundle.message("debugger.configurable.display.name");
  31. private Configurable myRootConfigurable;
  32. private Configurable[] myChildren;
  33. public DebuggerConfigurable(Configurable rootConfigurable, List<Configurable> children) {
  34. myRootConfigurable = rootConfigurable;
  35. myChildren = children.toArray(new Configurable[children.size()]);
  36. }
  37. public String getDisplayName() {
  38. return DISPLAY_NAME;
  39. }
  40. public String getHelpTopic() {
  41. return myRootConfigurable != null? myRootConfigurable.getHelpTopic() : null;
  42. }
  43. public Configurable[] getConfigurables() {
  44. return myChildren;
  45. }
  46. public void apply() throws ConfigurationException {
  47. for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
  48. support.getSettingsPanelProvider().apply();
  49. }
  50. if (myRootConfigurable != null) {
  51. myRootConfigurable.apply();
  52. }
  53. }
  54. public boolean hasOwnContent() {
  55. return myRootConfigurable != null;
  56. }
  57. public boolean isVisible() {
  58. return true;
  59. }
  60. public Runnable enableSearch(final String option) {
  61. return null;
  62. }
  63. public JComponent createComponent() {
  64. return myRootConfigurable != null ? myRootConfigurable.createComponent() : null;
  65. }
  66. public boolean isModified() {
  67. return myRootConfigurable != null && myRootConfigurable.isModified();
  68. }
  69. public void reset() {
  70. if (myRootConfigurable != null) {
  71. myRootConfigurable.reset();
  72. }
  73. }
  74. public void disposeUIResources() {
  75. if (myRootConfigurable != null) {
  76. myRootConfigurable.disposeUIResources();
  77. }
  78. }
  79. @NotNull
  80. @NonNls
  81. public String getId() {
  82. return "project.propDebugger";
  83. }
  84. }