本文整理汇总了Java中org.openide.awt.NotificationDisplayer类的典型用法代码示例。如果您正苦于以下问题:Java NotificationDisplayer类的具体用法?Java NotificationDisplayer怎么用?Java NotificationDisplayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NotificationDisplayer类属于org.openide.awt包,在下文中一共展示了NotificationDisplayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyBackupCreation
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
private static void notifyBackupCreation(ModelerFile file, FileObject backupFile) {
if(backupFile==null){
return;
}
NotificationDisplayer.getDefault().notify("Backup created",
ImageUtilities.image2Icon(file.getIcon()),// ImageUtilities.loadImageIcon("org/netbeans/jpa/modeler/specification/model/file/JPA_FILE_ICON.png", false),
"Previous state of file has been saved to " + backupFile.getName() + ". Click here to delete it", (ActionEvent e) -> {
try {
if (backupFile.isValid()) {
backupFile.delete();
}
} catch (IOException ex) {
file.handleException(ex);
}
}, NotificationDisplayer.Priority.NORMAL, NotificationDisplayer.Category.INFO);
}
示例2: notifyAboutMultipleInstallations
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
@NbBundle.Messages({
"NotifyMultipleInstallations.title=Multiple MySQL installations found",
"NotifyMultipleInstallations.text=Select the installation to use"
})
private static void notifyAboutMultipleInstallations() {
NotificationDisplayer.getDefault().notify(
Bundle.NotifyMultipleInstallations_title(),
ImageUtilities.loadImageIcon(ICON_BASE, false),
Bundle.NotifyMultipleInstallations_text(),
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SelectInstallationPanel.showSelectInstallationDialog();
}
}, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.WARNING);
}
示例3: warnNoTestCoS
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
@Messages({
"CosChecker.no_test_cos.title=Not using Compile on Save",
"CosChecker.no_test_cos.details=Compile on Save mode can speed up single test execution for many projects."
})
static void warnNoTestCoS(RunConfig config) {
if (warnedNoCoS) {
return;
}
final Project project = config.getProject();
if (project == null) {
return;
}
final Notification n = NotificationDisplayer.getDefault().notify(CosChecker_no_test_cos_title(), ImageUtilities.loadImageIcon(SUGGESTION, true), CosChecker_no_test_cos_details(), new ActionListener() {
@Override public void actionPerformed(ActionEvent e) {
showCompilePanel(project);
}
}, NotificationDisplayer.Priority.LOW);
RequestProcessor.getDefault().post(new Runnable() {
@Override public void run() {
n.clear();
}
}, 15 * 1000);
warnedNoCoS = true;
}
示例4: notifyAvailable
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
public void notifyAvailable () {
remindLater ();
String msg = NbBundle.getMessage (ImportManager.class,
"ImportNotifier_PluginAvailableForImport", // NOI18N
toImport.size () + toInstall.size ());
String details = NbBundle.getMessage (ImportManager.class,
"ImportNotifier_PluginAvailableForImport_Details", // NOI18N
srcCluster);
MyAction a = new MyAction();
synchronized( this ) {
if( null != currentNotification ) {
currentNotification.clear();
}
Notification notification = NotificationDisplayer.getDefault().notify(msg,
ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/pluginimporter/resources/import.png", false), //NOI18N
details,
a);
a.notification = notification;
currentNotification = notification;
}
}
示例5: notifyWarning
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
@Messages({"writePermission=You don't have permission to install JUnit Library into the installation directory which is recommended.",
"showDetails=Show details"})
private static void notifyWarning(final OperationContainer<InstallSupport> oc, final UpdateElement jUnitElement, final UpdateUnit jUnitLib) {
// lack of privileges for writing
ActionListener onMouseClickAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Runnable r = new Runnable() {
@Override
public void run() {
try {
install(oc, jUnitElement, jUnitLib, true);
} catch (OperationException ex) {
LOG.log(Level.INFO, "While installing " + jUnitLib + " thrown " + ex, ex);
}
}
};
showWritePermissionDialog(r);
}
};
String title = writePermission();
String description = showDetails();
NotificationDisplayer.getDefault().notify(title,
ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/pluginimporter/resources/warning.gif", false), // NOI18N
description, onMouseClickAction, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.WARNING);
}
示例6: notify
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
private static synchronized ExceptionFlasher notify(String summary, ImageIcon icon) {
if (flash == null) {
flash = new ExceptionFlasher();
} else {
flash.timer.restart();
if (flash.note != null) {
flash.note.clear();
}
}
JComponent detailsPanel = getDetailsPanel(summary);
JComponent bubblePanel = getDetailsPanel(summary);
flash.note = NotificationDisplayer.getDefault().notify(
NbBundle.getMessage(NotifyExcPanel.class, "NTF_ExceptionalExceptionTitle"),
icon, bubblePanel, detailsPanel,
NotificationDisplayer.Priority.SILENT, NotificationDisplayer.Category.ERROR);
return flash;
}
示例7: NotifySnapshot
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
NotifySnapshot(SlownessData data) {
this.data = data;
NotificationDisplayer.Priority priority = data.getTime() > PRIORITY ?
Priority.LOW : Priority.SILENT;
String message = NbBundle.getMessage(NotifySnapshot.class, data.getSlownessType());
note = NotificationDisplayer.getDefault().notify(
message,
ImageUtilities.loadImageIcon("org/netbeans/modules/uihandler/vilik.png", true),
createPanel(), createPanel(),
priority,
NotificationDisplayer.Category.WARNING);
if (CLEAR > 0) {
Installer.RP.post(new Runnable() {
@Override
public void run() {
clear();
}
}, CLEAR, Thread.MIN_PRIORITY);
}
}
示例8: signOn
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
public static void signOn () {
// temprorary to investigate #203326
NotificationDisplayer.getDefault();
// end of investigation #203326
AutoupdateSettings.generateIdentity ();
if (timeToCheck ()) {
// schedule refresh providers
// install update checker when UI is ready (main window shown)
WindowManager.getDefault().invokeWhenUIReady(new Runnable () {
@Override
public void run () {
Installer.RP.post (doCheck, 5000);
}
});
} else {
// install update checker when UI is ready (main window shown)
WindowManager.getDefault().invokeWhenUIReady(new Runnable () {
@Override
public void run () {
Installer.RP.post (doCheckLazyUpdates, 11000);
}
});
}
}
示例9: notifyRestartNeeded
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
static void notifyRestartNeeded (final Runnable onMouseClick, final String tooltip) {
//final NotifyDescriptor nd = new NotifyDescriptor.Confirmation (
// getBundle ("RestartConfirmation_Message"),
// getBundle ("RestartConfirmation_Title"),
// NotifyDescriptor.YES_NO_OPTION);
ActionListener onClickAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//DialogDisplayer.getDefault ().notify (nd);
//if (NotifyDescriptor.OK_OPTION.equals (nd.getValue ())) {
onMouseClick.run ();
//}
}
};
synchronized (InstallStep.class) {
if (restartNotification != null) {
restartNotification.clear();
restartNotification = null;
}
restartNotification = NotificationDisplayer.getDefault().notify(tooltip,
ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/restart.png", false),
getBundle("RestartNeeded_Details"), onClickAction, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.WARNING);
}
}
示例10: notifyWritePermissionProblem
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
@Messages({
"# {0} - plugin_name",
"inBackground_WritePermission=You don''t have permission to install plugin {0} into the installation directory.",
"inBackground_WritePermission_Details=details", "cancel=Cancel", "install=Install anyway"})
private void notifyWritePermissionProblem(final OperationException ex, final UpdateElement culprit) {
// lack of privileges for writing
ActionListener onMouseClickAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ProblemPanel problem = new ProblemPanel(ex, culprit, false);
problem.showWriteProblemDialog();
}
};
String title = inBackground_WritePermission(culprit.getDisplayName());
String description = inBackground_WritePermission_Details();
NotificationDisplayer.getDefault().notify(title,
ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/error.png", false), // NOI18N
description, onMouseClickAction, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.ERROR);
}
示例11: notifyLowMemory
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
@Override
public void notifyLowMemory(String rootName) {
if (PRIORITY != null) {
NotificationDisplayer.getDefault().notify(
NbBundle.getMessage(UIProviderImpl.class, "TITLE_LowMemory"),
ImageUtilities.loadImageIcon(WARNING_ICON, false),
NbBundle.getMessage(UIProviderImpl.class, "MSG_LowMemory", rootName),
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
final URL url = new URL(NbBundle.getMessage(UIProviderImpl.class, "URL_LowMemory"));
HtmlBrowser.URLDisplayer.getDefault().showURLExternal(url);
} catch (MalformedURLException ex) {
Exceptions.printStackTrace(ex);
}
}
},
PRIORITY, NotificationDisplayer.Category.ERROR);
}
}
示例12: clipboardChanged
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
@Override
public void clipboardChanged(ClipboardEvent ev) {
ExClipboard clipboard = ev.getClipboard();
Transferable transferable = null;
String clipboardContent = null;
try {
transferable = clipboard.getContents(null);
if (transferable != null && transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
clipboardContent = (String) transferable.getTransferData(DataFlavor.stringFlavor);
}
} catch (OutOfMemoryError oom) {
NotificationDisplayer.getDefault().notify( NbBundle.getBundle(ClipboardHistory.class).getString("clipboard-history-oom"),NotificationDisplayer.Priority.NORMAL.getIcon(), NbBundle.getBundle(ClipboardHistory.class).getString("clipboard-history-oom-details"), null);
return;
} catch (IOException ioe) {
//ignored for bug #218255
} catch (UnsupportedFlavorException ufe) {
}
if (clipboardContent != null) {
addHistory(transferable, clipboardContent);
}
}
示例13: show
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
/**
* Show message with the specified type and action listener
*/
public static Notification show(String title, String message, MessageType type, ActionListener actionListener, final int timeout) {
if (message == null) {
message = "null";
}
if (title == null) {
title = "null";
}
final Notification n = (Notification) NotificationDisplayer.getDefault().notify(title, type.getIcon(), message, actionListener);
if (timeout > 0) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
Timer timer = new Timer(timeout, new ActionListener() {
public void actionPerformed(ActionEvent e) {
n.clear();
}
});
timer.setRepeats(false);
timer.start();
}
});
}
return n;
}
示例14: store
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
@NbBundle.Messages({
"LBL_RestartRequest=JSHint plugin asks for restart",
"DESC_RestartRequest=Your changes to the configuration of the plugin will take effect after a restart.",
"ICON_RestartRequest="
})
void store() {
Preferences p = NbPreferences.forModule(JSHintPanel.class);
String oldJSFiile = p.get("jshint.js", defaultJSFile);
String newJSFile = jSFileTextField.getText();
if (!oldJSFiile.equals(newJSFile)) {
NotificationDisplayer.getDefault().notify(Bundle.LBL_RestartRequest(), new ImageIcon(Bundle.ICON_RestartRequest()), Bundle.DESC_RestartRequest(), new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
LifecycleManager dlm = LifecycleManager.getDefault();
dlm.markForRestart();
dlm.exit();
}
});
}
p.put("jshint.js", newJSFile);
p.putBoolean("show.annotations", showAnnotationsCheckBox.isSelected());
}
示例15: getConfig
import org.openide.awt.NotificationDisplayer; //导入依赖的package包/类
@NbBundle.Messages({
"LBL_InvalidRC=Invalid .jshintrc",
"# {0} - Linted JavaScript file",
"# {1} - RC file",
"DESC_InvalidRC=File {0} was linted with default configuration because its related {1} is not valid json",
"ICON_InvalidRC="
})
private Scriptable getConfig(Context cx, FileObject fo) throws ParseException, IOException {
JsonParser parser = new JsonParser(cx, scope);
FileObject config = findConfig(fo);
if (config == null) {
return cx.newObject(scope);
}
String json = config.asText();
try {
return (Scriptable) parser.parseValue(json);
}
catch (ParseException ex) {
JTextArea text = new JTextArea(Bundle.DESC_InvalidRC(fo.getPath(), config.getPath()));
NotificationDisplayer.getDefault().notify(Bundle.LBL_InvalidRC(), new ImageIcon(Bundle.ICON_InvalidRC()), text, text, NotificationDisplayer.Priority.NORMAL);
return cx.newObject(scope);
}
}