当前位置: 首页>>代码示例>>Java>>正文


Java MasterDetails类代码示例

本文整理汇总了Java中com.intellij.openapi.options.MasterDetails的典型用法代码示例。如果您正苦于以下问题:Java MasterDetails类的具体用法?Java MasterDetails怎么用?Java MasterDetails使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MasterDetails类属于com.intellij.openapi.options包,在下文中一共展示了MasterDetails类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processConfigurables

import com.intellij.openapi.options.MasterDetails; //导入依赖的package包/类
private static void processConfigurables(final Configurable[] configurables,
                                         final HashMap<SearchableConfigurable, TreeSet<OptionDescription>> options) {
  for (Configurable configurable : configurables) {
    if (configurable instanceof SearchableConfigurable) {
      TreeSet<OptionDescription> configurableOptions = new TreeSet<OptionDescription>();

      if (configurable instanceof Configurable.Composite) {
        final Configurable[] children = ((Configurable.Composite)configurable).getConfigurables();
        processConfigurables(children, options);
      }

      //ignore invisible root nodes
      if (configurable instanceof SearchableConfigurable.Parent && !((SearchableConfigurable.Parent)configurable).isVisible()) {
        continue;
      }

      options.put((SearchableConfigurable)configurable, configurableOptions);

      if (configurable instanceof MasterDetails) {
        final MasterDetails md = (MasterDetails)configurable;
        md.initUi();
        _processComponent(configurable, configurableOptions, md.getMaster());
        _processComponent(configurable, configurableOptions, md.getDetails().getComponent());
      }
      else {
        _processComponent(configurable, configurableOptions, configurable.createComponent());
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:SearchUtil.java

示例2: create

import com.intellij.openapi.options.MasterDetails; //导入依赖的package包/类
/**
 * Creates UI component for the specified configurable.
 * If a component is created successfully the configurable will be reset.
 * If the configurable implements {@link MasterDetails},
 * created component will not have the following modifications.
 * If the configurable does not implement {@link Configurable.NoMargin},
 * this method sets an empty border with default margins for created component.
 * If the configurable does not implement {@link Configurable.NoScroll},
 * this method adds a scroll bars for created component.
 */
@Override
protected JComponent create(final Configurable configurable) {
  return configurable == null ? null : ApplicationManager.getApplication().runReadAction(new Computable<JComponent>() {
    @Override
    public JComponent compute() {
      JComponent component = null;
      long time = System.currentTimeMillis();
      try {
        component = configurable.createComponent();
      }
      catch (Exception unexpected) {
        LOG.error("cannot create configurable component", unexpected);
      }
      finally {
        warn(configurable, "create", time);
      }
      if (component != null) {
        reset(configurable);
        if (ConfigurableWrapper.cast(MasterDetails.class, configurable) == null) {
          if (ConfigurableWrapper.cast(Configurable.NoMargin.class, configurable) == null) {
            if (!component.getClass().equals(JPanel.class)) {
              // some custom components do not support borders
              JPanel panel = new JPanel(new BorderLayout());
              panel.add(BorderLayout.CENTER, component);
              component = panel;
            }
            component.setBorder(JBUI.Borders.empty(5, 10, 10, 10));
          }
          if (ConfigurableWrapper.cast(Configurable.NoScroll.class, configurable) == null) {
            JScrollPane scroll = ScrollPaneFactory.createScrollPane(null, true);
            scroll.setViewport(new GradientViewport(component, JBUI.insetsTop(5), true));
            scroll.getVerticalScrollBar().setUnitIncrement(JBUI.scale(10));
            component = scroll;
          }
        }
      }
      return component;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:ConfigurableCardPanel.java


注:本文中的com.intellij.openapi.options.MasterDetails类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。