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