Search in sources :

Example 1 with NotifyDescriptor

use of org.openide.NotifyDescriptor in project gephi by gephi.

the class ReporterHandler method publish.

@Override
public void publish(LogRecord record) {
    if (record.getThrown() == null) {
        return;
    }
    throwable = record.getThrown();
    if (throwable != null && throwable instanceof OutOfMemoryError) {
        Handler[] handlers = Logger.getLogger("").getHandlers();
        for (int i = 0; i < handlers.length; i++) {
            Handler h = handlers[i];
            h.close();
        }
        NotifyDescriptor nd = new NotifyDescriptor.Message(MEMORY_ERROR, NotifyDescriptor.ERROR_MESSAGE);
        DialogDisplayer.getDefault().notify(nd);
        LifecycleManager.getDefault().exit();
    }
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) Handler(java.util.logging.Handler)

Example 2 with NotifyDescriptor

use of org.openide.NotifyDescriptor in project gephi by gephi.

the class Upgrader method showRestartDialog.

private boolean showRestartDialog() {
    String msg = NbBundle.getMessage(Upgrader.class, "Upgrader.restart.message");
    String title = NbBundle.getMessage(Upgrader.class, "Upgrader.restart.title");
    NotifyDescriptor nd = new NotifyDescriptor.Confirmation(msg, title, NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.YES_OPTION) {
        return true;
    }
    return false;
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor)

Example 3 with NotifyDescriptor

use of org.openide.NotifyDescriptor in project gephi by gephi.

the class Upgrader method showUpgradeDialog.

private boolean showUpgradeDialog(File source) {
    String msg = NbBundle.getMessage(Upgrader.class, "Upgrader.message", source.getName());
    String title = NbBundle.getMessage(Upgrader.class, "Upgrader.title");
    NotifyDescriptor nd = new NotifyDescriptor.Confirmation(msg, title, NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.YES_OPTION) {
        return true;
    }
    return false;
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor)

Example 4 with NotifyDescriptor

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

the class RealtimeRenderSettingsPanel method chooseDriver.

private Object chooseDriver(List<DeviceInfo> vals) throws HeadlessException {
    if (vals == null || vals.size() == 0) {
        NotifyDescriptor nd = new NotifyDescriptor("Could not discover devices for this driver.", "Error", NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.ERROR_MESSAGE, null, null);
        DialogDisplayer.getDefault().notify(nd);
        return null;
    }
    Object retVal = JOptionPane.showInputDialog(WindowManager.getDefault().getMainWindow(), "Choose Device:", "Choose Device", JOptionPane.PLAIN_MESSAGE, null, vals.toArray(), vals.get(0));
    return retVal;
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor)

Example 5 with NotifyDescriptor

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

the class OpenProjectAction method open.

public static void open(File selected) {
    File absoluteSelected = selected.getAbsoluteFile();
    File temp = absoluteSelected;
    File backup = new File(absoluteSelected.getAbsolutePath() + "~");
    boolean wasTempFile = false;
    if (backup.exists() && backup.lastModified() > temp.lastModified()) {
        String message = "A backup work file was found. This should only " + "occur if blue did not close successfully.\n\n" + "Would you like to open the backup file?\n\n" + "If you open the backup file, it will be required to " + "\"Save as\" the file to overwrite your old work.)";
        NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(message, NotifyDescriptor.YES_NO_CANCEL_OPTION);
        Object retVal = DialogDisplayer.getDefault().notify(descriptor);
        if (retVal == NotifyDescriptor.YES_OPTION) {
            temp = backup;
            wasTempFile = true;
        } else if (retVal == NotifyDescriptor.CANCEL_OPTION) {
            return;
        }
    }
    try {
        String text = TextUtilities.getTextFromFile(temp);
        BlueData tempData;
        if (text.startsWith("<blueData")) {
            Document d = new Document(text);
            tempData = BlueData.loadFromXML(d.getElement("blueData"));
        } else {
            return;
        // JOptionPane.showMessageDialog(this, BlueSystem.getString(
        // "blue.pre94"));
        // 
        // XMLSerializer xmlSer = new XMLSerializer();
        // BufferedReader xmlIn = new BufferedReader(
        // new StringReader(text));
        // 
        // tempData = (BlueData) xmlSer.read(xmlIn);
        // 
        // xmlIn.close();
        // tempData.upgradeData();
        }
        // InstrumentLibrary iLibrary = tempData.getInstrumentLibrary();
        // 
        // if (iLibrary != null) {
        // tempData.normalizeArrangement();
        // tempData.setInstrumentLibrary(null);
        // 
        // // TODO - TRANSLATE
        // String message = "This project contains an InstrumentLibrary \n" + "which is no longer being used in blue. The project's\n " + "orchestra will be updated to have individual copies of\n " + "each instrument from the library. \n\n" + "Upon saving, the InstrumentLibrary in this project will\n" + "no longer be accessible.\n\n" + "Would you like to import a copy of your library into " + "your user InstrumentLibrary?";
        // 
        // int retVal = JOptionPane.showConfirmDialog(this, message);
        // 
        // if (retVal == JOptionPane.YES_OPTION) {
        // BlueSystem.getUserInstrumentLibrary().importLibrary(
        // iLibrary);
        // }
        // }
        BlueProject project;
        if (wasTempFile) {
            project = new BlueProject(tempData, null);
            project.setTempFile(temp);
            project.setOpenedFromTempFile(true);
        } else {
            project = new BlueProject(tempData, temp);
        }
        BlueProjectManager projectManager = BlueProjectManager.getInstance();
        projectManager.setCurrentProject(project);
        if (!temp.getAbsolutePath().endsWith("~")) {
            RecentProjectsList.getInstance().addFile(temp.getAbsolutePath());
        }
        // this.blueDataFileArray.add(bdf);
        temp = null;
        // StatusBar.updateStatus(selected.getName() + " opened.");
        checkDependencies(tempData);
    } catch (FileNotFoundException fe) {
        String message = "Error: Could not open " + temp.toString();
        StatusDisplayer.getDefault().setStatusText(message);
        NotifyDescriptor descriptor = new NotifyDescriptor.Message(message, NotifyDescriptor.ERROR_MESSAGE);
        DialogDisplayer.getDefault().notify(descriptor);
    } catch (Exception e) {
        Exceptions.printStackTrace(e);
        StatusDisplayer.getDefault().setStatusText("Error: Could not open " + temp.toString());
    }
}
Also used : BlueData(blue.BlueData) FileNotFoundException(java.io.FileNotFoundException) Document(electric.xml.Document) FileNotFoundException(java.io.FileNotFoundException) NotifyDescriptor(org.openide.NotifyDescriptor) PolyObject(blue.soundObject.PolyObject) SoundObject(blue.soundObject.SoundObject) AudioFile(blue.soundObject.AudioFile) File(java.io.File)

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