示例#1
0
  private void processClose() {
    if (Registry.getInstance().isRestartNeeded()) {
      final ApplicationEx app = (ApplicationEx) ApplicationManager.getApplication();
      final ApplicationInfo info = ApplicationInfo.getInstance();

      final int r =
          Messages.showOkCancelDialog(
              myContent,
              "You need to restart " + info.getVersionName() + " for the changes to take effect",
              "Restart Required",
              (app.isRestartCapable() ? "Restart Now" : "Shutdown Now"),
              (app.isRestartCapable() ? "Restart Later" : "Shutdown Later"),
              Messages.getQuestionIcon());

      if (r == 0) {
        LaterInvocator.invokeLater(
            new Runnable() {
              public void run() {
                if (app.isRestartCapable()) {
                  app.restart();
                } else {
                  app.exit(true);
                }
              }
            },
            ModalityState.NON_MODAL);
      }
    }
  }
示例#2
0
 private void restoreDefaults() {
   final int r =
       Messages.showYesNoDialog(
           myContent,
           "Are you sure you want to revert registry settings to default values?",
           "Revert To Defaults",
           Messages.getQuestionIcon());
   if (r == 0) {
     Registry.getInstance().restoreDefaults();
     myModel.fireChanged();
     revaliateActions();
   }
 }
示例#3
0
 private void revaliateActions() {
   myRestoreDefaultsAction.setEnabled(!Registry.getInstance().isInDefaultState());
 }