class SearchAction extends AbstractAction {

    // Singleton so it persists when the dialog is closed
    private final SearchUIModel uiModel;

    SearchAction() {
        super(NbBundle.getMessage(SearchAction.class, "CTL_Search"),
            ImageUtilities.loadImageIcon("DesktopSearch/search.png", false));

        uiModel = new SearchUIModel();
    }

    @Override
    public void actionPerformed(ActionEvent ae) {<FILL_FUNCTION_BODY>}

    private void closeDialog(SearchDialog panel, JDialog dialog) {
        SwingUtilities.invokeLater(() -> {
            panel.unsetup();
            dialog.dispose();
        });
    }

    @Override
    public boolean isEnabled() {
        return Lookup.getDefault().lookup(ProjectController.class).hasCurrentProject();
    }
}

        if (isEnabled()) {
            SearchDialog panel = new SearchDialog(uiModel);
            JDialog dialog = new JDialog(WindowManager.getDefault().getMainWindow(),
                NbBundle.getMessage(SearchAction.class, "SearchDialog.title"), false);

            // Close behavior
            dialog.getRootPane().registerKeyboardAction(e -> {
                closeDialog(panel, dialog);
            }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
            dialog.addWindowFocusListener(new WindowAdapter() {

                @Override
                public void windowLostFocus(WindowEvent e) {
                    closeDialog(panel, dialog);
                }
            });

            // Drag behavior
            panel.instrumentDragListener(dialog);

            // Show dialog
            dialog.setUndecorated(true);
            dialog.getContentPane().add(panel);
            dialog.setBounds(212, 237, 679, 378);
            dialog.setVisible(true);
        }
    
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void <init>(java.lang.String, javax.swing.Icon) ,public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener) ,public java.lang.Object[] getKeys() ,public synchronized java.beans.PropertyChangeListener[] getPropertyChangeListeners() ,public java.lang.Object getValue(java.lang.String) ,public boolean isEnabled() ,public void putValue(java.lang.String, java.lang.Object) ,public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener) ,public void setEnabled(boolean) <variables>private static java.lang.Boolean RECONFIGURE_ON_NULL,private transient javax.swing.ArrayTable arrayTable,protected javax.swing.event.SwingPropertyChangeSupport changeSupport,protected boolean enabled