Java Code Examples for org.openide.util.HelpCtx#Provider

The following examples show how to use org.openide.util.HelpCtx#Provider . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Actions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** 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;
    }
}
 
Example 2
Source File: ProfilingPointWizard.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public HelpCtx getHelp() {
    Component customizer = getComponent();

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

    return ((HelpCtx.Provider) customizer).getHelpCtx();
}
 
Example 3
Source File: ProfilingPointWizard.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public HelpCtx getHelp() {
    if ((customizer == null) || !(customizer instanceof HelpCtx.Provider)) {
        return null;
    }

    return ((HelpCtx.Provider) customizer).getHelpCtx();
}
 
Example 4
Source File: PanelSupportedFrameworksVisual.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Help context where to find more about the paste type action.
 * @return the help context for this action
 */
public HelpCtx getHelpCtx() {
    if (jPanelConfig.getComponentCount()>0){
        for (int i = 0; i < jPanelConfig.getComponentCount(); i++)
            if (jPanelConfig.getComponent(i) instanceof  HelpCtx.Provider)
                return ((HelpCtx.Provider)jPanelConfig.getComponent(i)).getHelpCtx();
    }
    return null;
}
 
Example 5
Source File: JSFConfigurationWizardPanelVisual.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Help context where to find more about the paste type action.
 * @return the help context for this action
 */
public HelpCtx getHelpCtx() {
    if (jPanelConfig.getComponentCount()>0){
        for (int i = 0; i < jPanelConfig.getComponentCount(); i++)
            if (jPanelConfig.getComponent(i) instanceof  HelpCtx.Provider)
                return ((HelpCtx.Provider)jPanelConfig.getComponent(i)).getHelpCtx();
    }
    return null;
}
 
Example 6
Source File: PhpFrameworksPanelVisual.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public HelpCtx getHelpCtx() {
    for (Component component : configPanel.getComponents()) {
        if (component instanceof HelpCtx.Provider) {
            HelpCtx helpCtx = ((HelpCtx.Provider) component).getHelpCtx();
            if (helpCtx != null) {
                return helpCtx;
            }
        }
    }
    return null;
}
 
Example 7
Source File: ProfilingPointsManager.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 8
Source File: HelpAction.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
public HelpAction(HelpCtx.Provider delegateHelpCtx) {
    this.delegateHelpCtx = delegateHelpCtx;
    this.helpCtx = null;
    initProperties();
}