Search in sources :

Example 16 with NotifyDescriptor

use of org.openide.NotifyDescriptor in project gephi-plugins-bootcamp by gephi.

the class TestAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    // Do something, display a message
    NotifyDescriptor d = new NotifyDescriptor.Message("Hello...now trying to display a dialog", NotifyDescriptor.INFORMATION_MESSAGE);
    DialogDisplayer.getDefault().notify(d);
    // Do something - for instance display a dialog
    // Dialogs API documentation: http://bits.netbeans.org/dev/javadoc/org-openide-dialogs/index.html?overview-summary.html
    DialogDescriptor dd = new DialogDescriptor(new JPanel(), "My Dialog", false, null);
    DialogDisplayer.getDefault().notify(dd);
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) JPanel(javax.swing.JPanel) DialogDescriptor(org.openide.DialogDescriptor)

Example 17 with NotifyDescriptor

use of org.openide.NotifyDescriptor in project ACS by ACS-Community.

the class MainLauncherAction method performAction.

public void performAction() {
    if (mainClassName == null) {
        NotifyDescriptor usage = new NotifyDescriptor.Message("Main Class not set, use the command line option -J-D" + MAIN_CLASS_OPTION + " to set it");
        GPManager.notify(usage);
        return;
    }
    try {
        Class mainClass = Class.forName(MAIN_CLASS_OPTION);
        Method mainMeth = mainClass.getDeclaredMethod("main", new Class[] { String[].class });
        mainMeth.invoke(null, null);
    } catch (ClassNotFoundException ex) {
        NotifyDescriptor err = new NotifyDescriptor.Message("class not found " + MAIN_CLASS_OPTION);
        GPManager.notify(err);
    } catch (NoSuchMethodException ex) {
        NotifyDescriptor err = new NotifyDescriptor.Message("class " + MAIN_CLASS_OPTION + " has no main(String[]) method");
        GPManager.notify(err);
    } catch (IllegalAccessException ex) {
        NotifyDescriptor err = new NotifyDescriptor.Message("error invoking main on class " + MAIN_CLASS_OPTION);
        GPManager.notify(err);
    } catch (InvocationTargetException ex) {
        // the main method has been executed and thrown an exception
        GPManager.notify(GPManager.EXCEPTION, ex);
    }
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 18 with NotifyDescriptor

use of org.openide.NotifyDescriptor in project blue by kunstmusik.

the class MidiImportSettingsDialog method referenceButtonActionPerformed.

// </editor-fold>//GEN-END:initComponents
private void referenceButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_referenceButtonActionPerformed
    NotifyDescriptor nd = new NotifyDescriptor.Message(REFERENCE, NotifyDescriptor.INFORMATION_MESSAGE);
    DialogDisplayer.getDefault().notify(nd);
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor)

Example 19 with NotifyDescriptor

use of org.openide.NotifyDescriptor in project blue by kunstmusik.

the class BlueProjectManager method saveAs.

public boolean saveAs() {
    FileChooserManager fcm = FileChooserManager.getDefault();
    if (getCurrentProject().getDataFile() != null) {
        fcm.setSelectedFile(this.getClass(), getCurrentProject().getDataFile());
    } else {
        fcm.setSelectedFile(this.getClass(), new File(GeneralSettings.getInstance().getDefaultDirectory() + File.separator + "default.blue"));
    }
    File rValue = fcm.showSaveDialog(this.getClass(), WindowManager.getDefault().getMainWindow());
    if (rValue != null) {
        File temp = rValue;
        if (!(temp.getName().trim().endsWith(".blue"))) {
            temp = new File(temp.getAbsolutePath() + ".blue");
        }
        if (temp.exists()) {
            NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation("Are you sure you would like to overwite the project file: " + temp.getAbsolutePath(), "Overwrite Project?");
            Object retVal = DialogDisplayer.getDefault().notify(descriptor);
            if (retVal != NotifyDescriptor.YES_OPTION) {
                return false;
            }
        }
        if (getCurrentProject().isOpenedFromTempFile()) {
            getCurrentProject().getTempFile().delete();
            getCurrentProject().setOpenedFromTempFile(false);
        }
        try (PrintWriter out = new PrintWriter(new FileWriter(temp))) {
            BlueData data = getCurrentProject().getData();
            out.print(data.saveAsXML().toString());
            out.flush();
        } catch (Exception e) {
            NotifyDescriptor descriptor = new NotifyDescriptor.Message("Could not save file:\n\n" + e.getLocalizedMessage(), NotifyDescriptor.ERROR_MESSAGE);
            DialogDisplayer.getDefault().notify(descriptor);
        }
        StatusDisplayer.getDefault().setStatusText("File saved: " + temp.getName());
        // ProgramOptions.addRecentFile(temp);
        // blueMenuBar.resetRecentFiles();
        // ProgramOptions.save();
        // 
        RecentProjectsList.getInstance().addFile(temp.getAbsolutePath());
        // fileName = temp;
        getCurrentProject().setDataFile(temp);
        BlueSystem.setCurrentProjectDirectory(temp.getParentFile());
        temp = null;
        fireProjectFileChanged();
        // setRevertEnabled();
        return true;
    // }
    // else if (rValue == JFileChooser.CANCEL_OPTION) {
    // StatusBar.updateStatus(BlueSystem.getString(
    // "message.actionCancelled"));
    // return false;
    } else {
        return false;
    }
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) BlueData(blue.BlueData) FileWriter(java.io.FileWriter) FileChooserManager(blue.ui.utilities.FileChooserManager) PolyObject(blue.soundObject.PolyObject) File(java.io.File) IOException(java.io.IOException) PrintWriter(java.io.PrintWriter)

Example 20 with NotifyDescriptor

use of org.openide.NotifyDescriptor in project blue by kunstmusik.

the class BlueProjectManager method saveCheck.

private boolean saveCheck() {
    NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation("Do you wish to save the current project?", "Save Project?");
    Object retVal = DialogDisplayer.getDefault().notify(descriptor);
    if (retVal == NotifyDescriptor.YES_OPTION) {
        if (getCurrentProject().getDataFile() != null) {
            save();
            return true;
        }
        return (saveAs());
    } else if (retVal == NotifyDescriptor.NO_OPTION) {
        return true;
    }
    return false;
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) PolyObject(blue.soundObject.PolyObject)

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