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();
}
}
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;
}
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;
}
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;
}
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());
}
}
Aggregations