use of com.igormaznitsa.ideamindmap.swing.UriEditPanel in project netbeans-mmd-plugin by raydac.
the class IdeaUtils method editURI.
public static MMapURI editURI(final MindMapDocumentEditor editor, final String title, final MMapURI uri) {
final UriEditPanel uriEditor = new UriEditPanel(uri == null ? null : uri.asString(false, false));
uriEditor.doLayout();
uriEditor.setPreferredSize(new Dimension(450, uriEditor.getPreferredSize().height));
if (plainMessageOkCancel(editor.getProject(), title, uriEditor)) {
final String text = uriEditor.getText();
if (text.isEmpty()) {
return EMPTY_URI;
}
try {
if (!new URI(text).isAbsolute())
throw new URISyntaxException(text, "URI is not absolute one");
return new MMapURI(text.trim());
} catch (URISyntaxException ex) {
editor.getDialogProvider().msgError(null, String.format(BUNDLE.getString("NbUtils.errMsgIllegalURI"), text));
return null;
}
} else {
return null;
}
}
Aggregations