use of com.igormaznitsa.sciareto.ui.misc.DonateButton in project netbeans-mmd-plugin by raydac.
the class MessagesService method doAction.
protected void doAction() {
final Preferences prefs = PreferencesManager.getInstance().getPreferences();
if (!prefs.getBoolean(PROPERTY_OFFER_TO_DONATE_WAS_SHOWN, false)) {
final long totalUpstartTime = prefs.getLong(Main.PROPERTY_TOTAL_UPSTART, 0L);
if (totalUpstartTime >= (1000L * 3600L * 24L)) {
final Timer timer = new Timer(60000, new ActionListener() {
@Override
public void actionPerformed(@Nonnull final ActionEvent e) {
final String text = "<html>You have been using the application for long time!<br>If you like it then you could support us and <a href=\"#\">make a donation</a>!</html>";
final JHtmlLabel label = new JHtmlLabel(text);
label.addLinkListener(new JHtmlLabel.LinkListener() {
@Override
public void onLinkActivated(@Nonnull final JHtmlLabel source, @Nonnull final String link) {
new DonateButton().doClick();
}
});
NotificationManager.getInstance().showNotification(null, "Do you like the application?", NotificationManager.Type.INFO, label);
prefs.putBoolean(PROPERTY_OFFER_TO_DONATE_WAS_SHOWN, true);
PreferencesManager.getInstance().flush();
}
});
timer.setRepeats(false);
timer.start();
}
}
}
Aggregations