use of com.igormaznitsa.nbmindmap.nb.swing.UriEditPanel in project netbeans-mmd-plugin by raydac.
the class NbUtils method editURI.
@Nullable
public static MMapURI editURI(@Nullable Component parentComponent, @Nonnull final String title, @Nullable final MMapURI uri) {
final UriEditPanel textEditor = new UriEditPanel(uri == null ? null : uri.asString(false, false));
textEditor.doLayout();
textEditor.setPreferredSize(new Dimension(450, textEditor.getPreferredSize().height));
final NotifyDescriptor desc = new NotifyDescriptor.Confirmation(textEditor, title, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE);
if (DialogDisplayer.getDefault().notify(desc) == NotifyDescriptor.OK_OPTION) {
final String text = textEditor.getText();
if (text.isEmpty()) {
return EMPTY_URI;
}
try {
return new MMapURI(text.trim());
} catch (URISyntaxException ex) {
msgError(parentComponent, String.format(java.util.ResourceBundle.getBundle("com/igormaznitsa/nbmindmap/i18n/Bundle").getString("NbUtils.errMsgIllegalURI"), text));
return null;
}
} else {
return null;
}
}
Aggregations