本文整理匯總了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;
}