Search in sources :

Example 11 with NotifyDescriptor

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;
    }
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) UriEditPanel(com.igormaznitsa.nbmindmap.nb.swing.UriEditPanel) Dimension(java.awt.Dimension) URISyntaxException(java.net.URISyntaxException) MMapURI(com.igormaznitsa.mindmap.model.MMapURI) Nullable(javax.annotation.Nullable)

Example 12 with NotifyDescriptor

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);
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor)

Example 13 with NotifyDescriptor

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);
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) DataObject(org.openide.loaders.DataObject) FileObject(org.openide.filesystems.FileObject)

Example 14 with NotifyDescriptor

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);
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) DataObject(org.openide.loaders.DataObject) FileObject(org.openide.filesystems.FileObject)

Example 15 with NotifyDescriptor

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);
    }
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) Graph(org.gephi.graph.api.Graph) GraphModel(org.gephi.graph.api.GraphModel) Edge(org.gephi.graph.api.Edge) GraphController(org.gephi.graph.api.GraphController)

Aggregations

NotifyDescriptor (org.openide.NotifyDescriptor)26 FileObject (org.openide.filesystems.FileObject)5 File (java.io.File)4 IOException (java.io.IOException)4 BlueData (blue.BlueData)3 PolyObject (blue.soundObject.PolyObject)3 Nullable (javax.annotation.Nullable)3 DataObject (org.openide.loaders.DataObject)3 ScoreObject (blue.score.ScoreObject)2 SoundObject (blue.soundObject.SoundObject)2 FileChooserManager (blue.ui.utilities.FileChooserManager)2 Dimension (java.awt.Dimension)2 FileWriter (java.io.FileWriter)2 PrintWriter (java.io.PrintWriter)2 AudioFile (blue.soundObject.AudioFile)1 FrozenSoundObject (blue.soundObject.FrozenSoundObject)1 Instance (blue.soundObject.Instance)1 ScoreObjectEditor (blue.soundObject.editor.ScoreObjectEditor)1 MMapURI (com.igormaznitsa.mindmap.model.MMapURI)1 FileEditPanel (com.igormaznitsa.nbmindmap.nb.swing.FileEditPanel)1