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