Esempio n. 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);
      }
    }
  }
Esempio n. 2
0
 private MyTableModel() {
   myAll = Registry.getAll();
   Collections.sort(
       myAll,
       new Comparator<RegistryValue>() {
         public int compare(RegistryValue o1, RegistryValue o2) {
           return o1.getKey().compareTo(o2.getKey());
         }
       });
 }
Esempio n. 3
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();
   }
 }
    private MyTableModel() {
      myAll = Registry.getAll();
      final List<String> recent = getRecent();

      Collections.sort(
          myAll,
          new Comparator<RegistryValue>() {
            @Override
            public int compare(@NotNull RegistryValue o1, @NotNull RegistryValue o2) {
              final String key1 = o1.getKey();
              final String key2 = o2.getKey();
              final int i1 = recent.indexOf(key1);
              final int i2 = recent.indexOf(key2);
              final boolean c1 = i1 != -1;
              final boolean c2 = i2 != -1;
              if (c1 && !c2) return -1;
              if (!c1 && c2) return 1;
              if (c1 && c2) return i1 - i2;
              return key1.compareToIgnoreCase(key2);
            }
          });
    }
Esempio n. 5
0
 private void revaliateActions() {
   myRestoreDefaultsAction.setEnabled(!Registry.getInstance().isInDefaultState());
 }