org.openide.util.HelpCtx Java Examples

The following examples show how to use org.openide.util.HelpCtx. 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: DialogDescriptor.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Create dialog descriptor.
* If the action listener is null, all option buttons will close the dialog and the
* getValue () will provide the pressed option.
*
* @param innerPane inner component of the dialog, or String message
* @param title title of the dialog
* @param isModal modal status
* @param optionType one of the standard options (<code>OK_CANCEL_OPTION</code>, ...)
* @param initialValue default option (default button)
* @param optionsAlign specifies where to place
*   options in the dialog
* @param helpCtx help context specifying help page
* @param bl listener for the user's button presses or <code>null</code> for default close action on all options
*           (unless you specified the options yourself)
*/
public DialogDescriptor(
    final Object innerPane, final String title, final boolean isModal, final int optionType,
    final Object initialValue, final int optionsAlign, final HelpCtx helpCtx, final ActionListener bl
) {
    super(innerPane, title, optionType, PLAIN_MESSAGE, null, initialValue);
    this.modal = isModal;
    this.optionsAlign = optionsAlign;
    this.helpCtx = (helpCtx == null) ? HelpCtx.DEFAULT_HELP : helpCtx;
    this.buttonListener = bl;

    if (bl == null) {
        // if the listener is null all options are closing
        setClosingOptions(null);
    }
}
 
Example #2
Source File: MergeRevision.java    From netbeans with Apache License 2.0 6 votes vote down vote up
boolean show() {
    okButton = new JButton(NbBundle.getMessage(MergeRevision.class, "LBL_MergeRevision.OKButton.text")); //NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
    dd = new DialogDescriptor(panel, NbBundle.getMessage(MergeRevision.class, "LBL_MergeRevision.title"), true,  //NOI18N
            new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN,
            new HelpCtx("org.netbeans.modules.git.ui.merge.MergeRevision"), null); //NOI18N
    enableRevisionPanel();
    revisionPicker.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange (PropertyChangeEvent evt) {
            if (evt.getPropertyName() == RevisionDialogController.PROP_VALID) {
                setValid(Boolean.TRUE.equals(evt.getNewValue()));
            }
        }
    });
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.setVisible(true);
    return okButton == dd.getValue();
}
 
Example #3
Source File: AddModulePanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param props
 * @param initialFilterText initial filter text or null if not given
 * @return 
 */
public static ModuleDependency[] selectDependencies(final SingleModuleProperties props, final String initialFilterText) {
    final AddModulePanel addPanel;
    if (null != initialFilterText) {
        // init dialog with filter text
        addPanel = new AddModulePanel(props, initialFilterText);
    }
    else{
        // keep backwards compatibility
        addPanel = new AddModulePanel(props);
    }
    final DialogDescriptor descriptor = new DialogDescriptor(addPanel,
            getMessage("CTL_AddModuleDependencyTitle"));
    descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.AddModulePanel"));
    descriptor.setClosingOptions(new Object[0]);
    final Dialog d = DialogDisplayer.getDefault().createDialog(descriptor);
    descriptor.setButtonListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (DialogDescriptor.OK_OPTION.equals(e.getSource()) && addPanel.getSelectedDependencies().length == 0) {
                return;
            }
            d.setVisible(false);
            d.dispose();
        }
    });
    if (lastSize != null) {
        d.setBounds(lastSize);
    }
    d.setVisible(true);
    lastSize = d.getBounds();
    d.dispose();
    if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) {
        return addPanel.getSelectedDependencies();
    } else {
        return new ModuleDependency[0]; // #114932
    }
}
 
Example #4
Source File: OpenActionTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** 
 * Test getHelpCtx method. 
 */ 
public void testGetHelpCtx() { 
    HelpCtx expected = new HelpCtx(OpenAction.class);; 
    HelpCtx result   = instance.getHelpCtx(); 
     
    assertEquals(expected, result); 
}
 
Example #5
Source File: EditDBNodeAction.java    From BART with MIT License 5 votes vote down vote up
private Dialog createDialog(Object innerPane, Object[] options)   {
     DialogDescriptor dsc = new DialogDescriptor(innerPane, 
                            null, 
                            true, 
                            options, 
                            null,
                            DialogDescriptor.DEFAULT_ALIGN, 
                            HelpCtx.DEFAULT_HELP, 
                            null);
    return DialogDisplayer.getDefault().createDialog(dsc);
}
 
Example #6
Source File: CustomizerProviderImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void showCustomizer(String preselectedCategory, String preselectedSubCategory) {
    ProjectCustomizer.createCustomizerDialog("Projects/" + JDKProject.PROJECT_KEY + "/Customizer",
                                             project.getLookup(),
                                             preselectedCategory,
                                             evt -> {},
                                             HelpCtx.DEFAULT_HELP).setVisible(true);
}
 
Example #7
Source File: HelpCtxProcessor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Show the help.
 * @param actionEvent ignored
 */
public @Override void actionPerformed(ActionEvent actionEvent) {
    Help h = findHelp();
    if (h != null) {
        Installer.log.log(Level.FINE, "ShortcutAction.actionPerformed: {0} showmaster={1}", new Object[] {helpID, showmaster});
        h.showHelp(new HelpCtx(helpID), showmaster);
    } else {
        Toolkit.getDefaultToolkit().beep();
    }
}
 
Example #8
Source File: SelectionPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Shows the edit panel.
 */
@org.netbeans.api.annotations.common.SuppressWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ",
        justification = "Comparing instances is OK here")
@NbBundle.Messages({
    "SelectionPanel.editDialog.title=Edit Library",
    "SelectionPanel.editDialog.update=Update",
    "SelectionPanel.editDialog.cancel=Cancel"
})
private void showEditPanel() {
    int selectedRow = librariesTable.getSelectedRow();
    Library.Version selectedVersion = libraries.get(selectedRow);
    Library library = libraryInfo.get(selectedVersion.getLibrary().getName());
    EditPanel editPanel = new EditPanel(library, selectedVersion);
    String update = Bundle.SelectionPanel_editDialog_update();
    String cancel = Bundle.SelectionPanel_editDialog_cancel();
    DialogDescriptor descriptor = new DialogDescriptor(
            editPanel,
            Bundle.SelectionPanel_editDialog_title(),
            true,
            new Object[] { update, cancel },
            update,
            DialogDescriptor.DEFAULT_ALIGN,
            HelpCtx.DEFAULT_HELP,
            null
    );
    Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor);
    dialog.setVisible(true);
    if (descriptor.getValue() == update) {
        Library.Version version = editPanel.getSelection();
        if (version == null) {
            removeSelectedLibraries();
        } else {
            addLibrary(version);
        }
    }
}
 
Example #9
Source File: JSFConfigurationWizardPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public HelpCtx getHelp() {
    HelpCtx helpCtx = null;
    if (component != null && (helpCtx = component.getHelpCtx())!=null)
        return helpCtx;
    return new HelpCtx("org.netbeans.modules.web.jsf.wizards.JSFConfigurationWizardPanel");
}
 
Example #10
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 #11
Source File: BugzillaExecutor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static boolean notifyHtmlMessage(String html, BugzillaRepository repository, boolean htmlTextIsAllYouGot) throws MissingResourceException {
    if (html != null && !html.trim().equals("")) {                          // NOI18N
        html = parseHtmlMessage(html, htmlTextIsAllYouGot);
        if(html == null) {
            return false;
        }
        final HtmlPanel p = new HtmlPanel();
        String label = NbBundle.getMessage(
                            BugzillaExecutor.class,
                            "MSG_ServerResponse",                           // NOI18N
                            new Object[] { repository.getDisplayName() }
                       );
        p.setHtml(repository.getUrl(), html, label);
        DialogDescriptor dialogDescriptor =
                new DialogDescriptor(
                        p,
                        NbBundle.getMessage(BugzillaExecutor.class, "CTL_ServerResponse"), // NOI18N
                        true,
                        new Object[] { NotifyDescriptor.CANCEL_OPTION },
                        NotifyDescriptor.CANCEL_OPTION,
                        DialogDescriptor.DEFAULT_ALIGN,
                        new HelpCtx(p.getClass()),
                        null
                );
        DialogDisplayer.getDefault().notify(dialogDescriptor);
        return true;
    }
    return false;
}
 
Example #12
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 #13
Source File: ObfuscateCustomizerPanel.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** Creates new form LwjglAppletCustomizerPanel */
public ObfuscateCustomizerPanel(ProjectExtensionProperties properties) {
    this.properties = properties;
    initComponents();
    loadProperties();
    HelpCtx.setHelpIDString(this, "sdk.application_deployment");
}
 
Example #14
Source File: InitializrProjectWizardPanel2.java    From nb-springboot with Apache License 2.0 5 votes vote down vote up
@Override
public HelpCtx getHelp() {
    // Show no Help button for this panel:
    return HelpCtx.DEFAULT_HELP;
    // If you have context help:
    // return new HelpCtx("help.key.here");
}
 
Example #15
Source File: TwigOptionsPanelController.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public HelpCtx getHelpCtx() {
    return new HelpCtx("org.netbeans.modules.php.twig.editor.Options"); //NOI18N
}
 
Example #16
Source File: ObjectAddFrameAction.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
public HelpCtx getHelpCtx() {
    return HelpCtx.DEFAULT_HELP;
}
 
Example #17
Source File: SelectExportMethodDialog.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
private static DialogDescriptor createDialog(Component parentComponent, String title, String text, String helpID, JCheckBox[] options) {
    final String copyToClipboardText = "Copy to Clipboard";  /*I18N*/
    final String writeToFileText = "Write to File"; /*I18N*/
    final String cancelText = "Cancel"; /*I18N*/

    final String iconDir = "/org/esa/snap/resources/images/icons/";
    final ImageIcon copyIcon = new ImageIcon(SelectExportMethodDialog.class.getResource(iconDir + "Copy16.gif"));
    final ImageIcon saveIcon = new ImageIcon(SelectExportMethodDialog.class.getResource(iconDir + "Save16.gif"));

    final JButton copyToClipboardButton = new JButton(copyToClipboardText);
    copyToClipboardButton.setMnemonic('b');
    copyToClipboardButton.setIcon(copyIcon);

    final JButton writeToFileButton = new JButton(writeToFileText);
    writeToFileButton.setMnemonic('W');
    writeToFileButton.setIcon(saveIcon);

    final JButton cancelButton = new JButton(cancelText);
    cancelButton.setMnemonic('C');
    cancelButton.setIcon(null);

    final JPanel panel = new JPanel(new GridBagLayout());
    final JPanel checkboxPanel = new JPanel(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.LINE_START;
    c.gridx = 0;
    c.gridy = GridBagConstraints.RELATIVE;
    for (JCheckBox option : options) {
        checkboxPanel.add(option, c);
    }
    c.gridx = 0;
    c.gridy = 0;
    panel.add(checkboxPanel, c);
    final JPanel buttonPanel = new JPanel(new FlowLayout());
    c.gridy = GridBagConstraints.RELATIVE;
    buttonPanel.add(copyToClipboardButton, c);
    buttonPanel.add(writeToFileButton, c);
    buttonPanel.add(cancelButton, c);
    c.gridx = 0;
    c.gridy = 1;
    panel.add(buttonPanel, c);

    final JOptionPane optionPane = new JOptionPane(text, /*I18N*/
                                                   JOptionPane.QUESTION_MESSAGE,
                                                   JOptionPane.DEFAULT_OPTION,
                                                   null,
                                                   new JPanel[]{panel},
                                                   copyToClipboardButton);
    final JDialog dialog = optionPane.createDialog(parentComponent, title);
    dialog.getContentPane().setLayout(new BoxLayout(dialog.getContentPane(), BoxLayout.Y_AXIS));
    if (helpID != null) {
        HelpCtx.setHelpIDString((JComponent) optionPane, helpID);
    }

    // Create action listener for all 3 buttons (as instance of an anonymous class)
    final ActionListener actionListener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            optionPane.setValue(e.getSource());
            dialog.setVisible(false);
            dialog.dispose();
        }
    };
    copyToClipboardButton.addActionListener(actionListener);
    writeToFileButton.addActionListener(actionListener);
    cancelButton.addActionListener(actionListener);

    return new DialogDescriptor(dialog, optionPane, copyToClipboardButton, writeToFileButton);
}
 
Example #18
Source File: RemoveServerAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public HelpCtx getHelpCtx() {
    return HelpCtx.DEFAULT_HELP;
}
 
Example #19
Source File: AddGoogleDependencyAction.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
public HelpCtx getHelpCtx() {
    return null;
}
 
Example #20
Source File: RemoveFilterAction.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public HelpCtx getHelpCtx() {
    return HelpCtx.DEFAULT_HELP;
}
 
Example #21
Source File: OpenModuleUrlAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public org.openide.util.HelpCtx getHelpCtx() {
    return HelpCtx.DEFAULT_HELP;
}
 
Example #22
Source File: GoToNodeSourceAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public HelpCtx getHelpCtx() {
    return HelpCtx.DEFAULT_HELP;
}
 
Example #23
Source File: TimeSeriesGraphForm.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
private JPanel createButtonPanel(final String helpID) {
        showTimeSeriesForSelectedPinsButton = ToolButtonFactory.createButton(
                    UIUtils.loadImageIcon("icons/SelectedPinSpectra24.gif"), true);
        showTimeSeriesForSelectedPinsButton.addActionListener(e -> {
            if (graphModel.isShowingAllPins()) {
                showTimeSeriesForAllPinsButton.setSelected(false);
                graphModel.setIsShowingAllPins(false);
            }
            graphModel.setIsShowingSelectedPins(showTimeSeriesForSelectedPinsButton.isSelected());
        });
        showTimeSeriesForSelectedPinsButton.setName("showTimeSeriesForSelectedPinsButton");
        showTimeSeriesForSelectedPinsButton.setToolTipText("Show time series for selected pin");

        //////////////////////////////////////////

        showTimeSeriesForAllPinsButton = ToolButtonFactory.createButton(
                    UIUtils.loadImageIcon("icons/PinSpectra24.gif"), true);
        showTimeSeriesForAllPinsButton.addActionListener(e -> {
            if (graphModel.isShowingSelectedPins()) {
                showTimeSeriesForSelectedPinsButton.setSelected(false);
                graphModel.setIsShowingSelectedPins(false);
            }
            graphModel.setIsShowingAllPins(showTimeSeriesForAllPinsButton.isSelected());
        });
        showTimeSeriesForAllPinsButton.setName("showTimeSeriesForAllPinsButton");
        showTimeSeriesForAllPinsButton.setToolTipText("Show time series for all pins");

        //////////////////////////////////////////

        showCursorTimeSeriesButton = ToolButtonFactory.createButton(
                    UIUtils.loadImageIcon("icons/CursorSpectrum24.gif"), true);
        showCursorTimeSeriesButton.addActionListener(e -> graphModel.setIsShowingCursorTimeSeries(showCursorTimeSeriesButton.isSelected()));
        showCursorTimeSeriesButton.setToolTipText("Show time series for cursor");
        showCursorTimeSeriesButton.setSelected(true);

        //////////////////////////////////////////

        exportTimeSeriesButton = ToolButtonFactory.createButton(
                    UIUtils.loadImageIcon("icons/Export24.gif"),
                    false);
        exportTimeSeriesButton.addActionListener(e -> {
            final ProductSceneView view = SnapApp.getDefault().getSelectedProductSceneView();

            JOptionPane.showMessageDialog(view, "Not available in the current version.", "Export data", JOptionPane.INFORMATION_MESSAGE);

            //@todo se remove message dialog and fix export that only the visible graph data will be exported
//                if (view != null
//                    && view.getProduct() != null
//                    && view.getProduct().getProductType().equals(AbstractTimeSeries.TIME_SERIES_PRODUCT_TYPE)
//                    && TimeSeriesMapper.getInstance().getTimeSeries(view.getProduct()) != null) {
//
//                    AbstractTimeSeries timeSeries = TimeSeriesMapper.getInstance().getTimeSeries(view.getProduct());
//                    ExportTimeBasedText.export(mainPanel, timeSeries, helpID);
//                }
        });
        exportTimeSeriesButton.setToolTipText("Export raster data time series of all pins");
        exportTimeSeriesButton.setName("exportTimeSeriesButton");
        final ProductSceneView sceneView = SnapApp.getDefault().getSelectedProductSceneView();
        if (sceneView != null) {
            exportTimeSeriesButton.setEnabled(sceneView.getProduct().getPinGroup().getNodeCount() > 0);
        } else {
            exportTimeSeriesButton.setEnabled(false);
        }

        AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help22.png"), false);
        helpButton.addActionListener(e -> new HelpCtx(helpID).display());
        helpButton.setToolTipText("Help");

        final TableLayout tableLayout = new TableLayout(1);
        tableLayout.setTablePadding(4, 4);
        tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST);
        tableLayout.setTableFill(TableLayout.Fill.HORIZONTAL);
        tableLayout.setTableWeightX(1.0);
        tableLayout.setTableWeightY(0.0);
        JPanel buttonPanel = new JPanel(tableLayout);

        buttonPanel.add(showTimeSeriesForSelectedPinsButton);
        buttonPanel.add(showTimeSeriesForAllPinsButton);
        buttonPanel.add(showCursorTimeSeriesButton);
        buttonPanel.add(exportTimeSeriesButton);
        buttonPanel.add(tableLayout.createVerticalSpacer());
        buttonPanel.add(helpButton);
        return buttonPanel;
    }
 
Example #24
Source File: RepositoryStep.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public HelpCtx getHelp () {
    return new HelpCtx(RepositoryStep.class);
}
 
Example #25
Source File: SaveFilterSettingsAction.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public HelpCtx getHelpCtx() {
    return HelpCtx.DEFAULT_HELP;
}
 
Example #26
Source File: ProfileAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public HelpCtx getHelpCtx() {
    return HelpCtx.DEFAULT_HELP;
}
 
Example #27
Source File: SpringCustomizerPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public HelpCtx getHelpCtx() {
    return new HelpCtx(SpringCustomizerPanel.class);
}
 
Example #28
Source File: GeneralOptionsPanelController.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public HelpCtx getHelpCtx() {
    return new HelpCtx(OptionsPanelController.class);
}
 
Example #29
Source File: IsolateCurrentModelAction.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
public HelpCtx getHelpCtx() {
   return HelpCtx.DEFAULT_HELP;
}
 
Example #30
Source File: MessageHandlerWizard.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public HelpCtx getHelp() {
    return new HelpCtx(MessageHandlerWizard.class);
}