Created
March 8, 2015 06:54
-
-
Save MitI-7/17adb29673b5325322df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.intellij.notification.Notification; | |
import com.intellij.notification.NotificationType; | |
import com.intellij.notification.Notifications; | |
import com.intellij.openapi.actionSystem.AnAction; | |
import com.intellij.openapi.actionSystem.AnActionEvent; | |
import com.intellij.openapi.wm.WindowManager; | |
import javax.swing.*; | |
public class NotificationSample extends AnAction { | |
public void actionPerformed(AnActionEvent e) { | |
// 表示される | |
Notifications.Bus.notify(new Notification("Sample", "Title1", "content1", NotificationType.INFORMATION)); | |
// ダイアログの表示 | |
SampleDialog sampleDialog = new SampleDialog(); | |
sampleDialog.setLocationRelativeTo(WindowManager.getInstance().getFrame(e.getProject()).getComponents()[0]); | |
sampleDialog.setVisible(true); | |
// 表示されない | |
Notifications.Bus.notify(new Notification("Sample", "Title2", "content2", NotificationType.INFORMATION)); | |
// 表示される | |
SwingUtilities.invokeLater(new Runnable() { | |
@Override | |
public void run() { | |
Notifications.Bus.notify(new Notification("Sample", "Title3", "content3", NotificationType.INFORMATION)); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment