Search in sources :

Example 1 with UriEditPanel

use of com.igormaznitsa.sciareto.ui.editors.mmeditors.UriEditPanel in project netbeans-mmd-plugin by raydac.

the class UiUtils method editURI.

@Nullable
public static MMapURI editURI(@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));
    if (DialogProviderManager.getInstance().getDialogProvider().msgOkCancel(null, title, textEditor)) {
        final String text = textEditor.getText();
        if (text.isEmpty()) {
            return EMPTY_URI;
        }
        try {
            return new MMapURI(text.trim());
        } catch (URISyntaxException ex) {
            DialogProviderManager.getInstance().getDialogProvider().msgError(null, String.format(BUNDLE.getString("NbUtils.errMsgIllegalURI"), text));
            return null;
        }
    } else {
        return null;
    }
}
Also used : UriEditPanel(com.igormaznitsa.sciareto.ui.editors.mmeditors.UriEditPanel) Dimension(java.awt.Dimension) URISyntaxException(java.net.URISyntaxException) MMapURI(com.igormaznitsa.mindmap.model.MMapURI) Nullable(javax.annotation.Nullable)

Aggregations

MMapURI (com.igormaznitsa.mindmap.model.MMapURI)1 UriEditPanel (com.igormaznitsa.sciareto.ui.editors.mmeditors.UriEditPanel)1 Dimension (java.awt.Dimension)1 URISyntaxException (java.net.URISyntaxException)1 Nullable (javax.annotation.Nullable)1