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


Java HelpCtx.Provider方法代码示例

本文整理汇总了Java中org.openide.util.HelpCtx.Provider方法的典型用法代码示例。如果您正苦于以下问题:Java HelpCtx.Provider方法的具体用法?Java HelpCtx.Provider怎么用?Java HelpCtx.Provider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.util.HelpCtx的用法示例。


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

示例1: getHelp

import org.openide.util.HelpCtx; //导入方法依赖的package包/类
public HelpCtx getHelp() {
    Component customizer = getComponent();

    if ((customizer == null) || !(customizer instanceof HelpCtx.Provider)) {
        return null;
    }

    return ((HelpCtx.Provider) customizer).getHelpCtx();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ProfilingPointWizard.java

示例2: findHelp

import org.openide.util.HelpCtx; //导入方法依赖的package包/类
/** Extracts help from action.
 */
private static HelpCtx findHelp(Action a) {
    if (a instanceof HelpCtx.Provider) {
        return ((HelpCtx.Provider) a).getHelpCtx();
    } else {
        return HelpCtx.DEFAULT_HELP;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:Actions.java

示例3: customize

import org.openide.util.HelpCtx; //导入方法依赖的package包/类
boolean customize(final ValidityAwarePanel customizer, Runnable updater, boolean focusToEditor) {
    ValidityAwarePanel showingCustomizer = getShowingCustomizer();

    if (showingCustomizer != null) {
        ProfilerDialogs.displayWarning(
                Bundle.ProfilingPointsManager_AnotherPpEditedMsg());
        SwingUtilities.getWindowAncestor(showingCustomizer).requestFocus();
        showingCustomizer.requestFocusInWindow();
    } else {
        CustomizerButton cb = getCustomizerButton();
        customizer.addValidityListener(cb);
        cb.setEnabled(customizer.areSettingsValid()); // In fact customizer should be valid but just to be sure...

        JPanel customizerContainer = new JPanel(new BorderLayout());
        JPanel customizerSpacer = new JPanel(new BorderLayout());
        customizerSpacer.setBorder(BorderFactory.createEmptyBorder(0, 0, 20, 0));
        customizerSpacer.add(customizer, BorderLayout.CENTER);
        customizerContainer.add(customizerSpacer, BorderLayout.CENTER);
        customizerContainer.add(new JSeparator(), BorderLayout.SOUTH);

        HelpCtx helpCtx = null;

        if (customizer instanceof HelpCtx.Provider) {
            helpCtx = ((HelpCtx.Provider) customizer).getHelpCtx();
        }

        DialogDescriptor dd = new DialogDescriptor(customizerContainer, Bundle.ProfilingPointsManager_PpCustomizerCaption(), false,
                                                   new Object[] { cb, DialogDescriptor.CANCEL_OPTION },
                                                   cb, 0, helpCtx, null);
        final Dialog d = DialogDisplayer.getDefault().createDialog(dd);
        d.addWindowListener(new CustomizerListener(d, dd, updater));
        d.setModal(true);
        // give focus to the initial focus target
        d.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                if (customizer.getInitialFocusTarget() != null) {
                    customizer.getInitialFocusTarget().requestFocusInWindow();
                }
            }
        });
        
        if (focusToEditor) {
            Dimension dim = d.getPreferredSize();
            Component masterComponent = WindowManager.getDefault().getRegistry().getActivated();
            if (masterComponent != null) {
                Rectangle b = masterComponent.getBounds();
                Point location = new Point((b.x + (b.width / 2)) - (dim.width / 2),
                                           (b.y + (b.height / 2)) - (dim.height / 2));
                SwingUtilities.convertPointToScreen(location, masterComponent);
                d.setLocation(location);
            }
        }
        
        d.setVisible(true);
        
        if (dd.getValue() == cb) {
            return true;
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:63,代码来源:ProfilingPointsManager.java


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