本文整理汇总了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());
}
}
}
}
示例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;
}
});
}