use of org.openide.NotifyDescriptor 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;
}
}
use of org.openide.NotifyDescriptor in project netbeans-mmd-plugin by raydac.
the class NbUtils method plainMessageOk.
public static void plainMessageOk(@Nullable Component parentComponent, @Nonnull final String title, @Nonnull final JComponent compo) {
final NotifyDescriptor desc = new NotifyDescriptor.Message(compo, NotifyDescriptor.PLAIN_MESSAGE);
desc.setTitle(title);
DialogDisplayer.getDefault().notify(desc);
}
use of org.openide.NotifyDescriptor in project netbeans-mmd-plugin by raydac.
the class NbUtils method msgConfirmOkCancel.
public static boolean msgConfirmOkCancel(@Nullable Component parentComponent, @Nonnull final String title, @Nonnull final String query) {
final NotifyDescriptor desc = new NotifyDescriptor.Confirmation(query, title, NotifyDescriptor.OK_CANCEL_OPTION);
final Object obj = DialogDisplayer.getDefault().notify(desc);
return NotifyDescriptor.OK_OPTION.equals(obj);
}
use of org.openide.NotifyDescriptor in project netbeans-mmd-plugin by raydac.
the class NbUtils method msgConfirmYesNo.
public static boolean msgConfirmYesNo(@Nullable Component parentComponent, @Nonnull final String title, @Nonnull final String query) {
final NotifyDescriptor desc = new NotifyDescriptor.Confirmation(query, title, NotifyDescriptor.YES_NO_OPTION);
final Object obj = DialogDisplayer.getDefault().notify(desc);
return NotifyDescriptor.YES_OPTION.equals(obj);
}
use of org.openide.NotifyDescriptor in project gephi-plugins-bootcamp by gephi.
the class RemoveSelfLoopsAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
// Get the current graph model
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
GraphModel graphModel = gc.getGraphModel();
if (graphModel != null) {
// Remove self loops
int removed = 0;
Graph graph = graphModel.getGraph();
graph.writeLock();
for (Edge edge : graph.getEdges().toArray()) {
if (edge.isSelfLoop()) {
graph.removeEdge(edge);
removed++;
}
}
graph.writeUnlock();
// Notification message
NotifyDescriptor d = new NotifyDescriptor.Message(removed + " self-loop have been removed", NotifyDescriptor.INFORMATION_MESSAGE);
DialogDisplayer.getDefault().notify(d);
} else {
// Error message
NotifyDescriptor d = new NotifyDescriptor.Message("No active workspace", NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notify(d);
}
}
Aggregations