Search in sources :

Example 1 with FileEditPanel

use of com.igormaznitsa.nbmindmap.nb.swing.FileEditPanel in project netbeans-mmd-plugin by raydac.

the class NbUtils method editFilePath.

@Nullable
public static FileEditPanel.DataContainer editFilePath(@Nullable Component parentComponent, @Nonnull final String title, @Nullable final File projectFolder, @Nullable final FileEditPanel.DataContainer data) {
    final FileEditPanel filePathEditor = new FileEditPanel(projectFolder, data);
    filePathEditor.doLayout();
    filePathEditor.setPreferredSize(new Dimension(450, filePathEditor.getPreferredSize().height));
    final NotifyDescriptor desc = new NotifyDescriptor.Confirmation(filePathEditor, title, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE);
    FileEditPanel.DataContainer result = null;
    if (DialogDisplayer.getDefault().notify(desc) == NotifyDescriptor.OK_OPTION) {
        result = filePathEditor.getData();
        if (!result.isValid()) {
            NbUtils.msgError(parentComponent, String.format(java.util.ResourceBundle.getBundle("com/igormaznitsa/nbmindmap/i18n/Bundle").getString("MMDGraphEditor.editFileLinkForTopic.errorCantFindFile"), result.getPath()));
            result = null;
        }
    }
    return result;
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) Dimension(java.awt.Dimension) FileEditPanel(com.igormaznitsa.nbmindmap.nb.swing.FileEditPanel) Nullable(javax.annotation.Nullable)

Aggregations

FileEditPanel (com.igormaznitsa.nbmindmap.nb.swing.FileEditPanel)1 Dimension (java.awt.Dimension)1 Nullable (javax.annotation.Nullable)1 NotifyDescriptor (org.openide.NotifyDescriptor)1