public void checkAllNow() {
    // Add all to be tracked
    Map<IInterpreterManager, Map<String, IInterpreterInfo>> addedToTrack = job.addAllToTrack();

    // remove from the preferences any ignore the user had set previously
    Set<Entry<IInterpreterManager, Map<String, IInterpreterInfo>>> entrySet =
        addedToTrack.entrySet();
    IPreferenceStore preferences = PydevPrefs.getPreferences();
    for (Entry<IInterpreterManager, Map<String, IInterpreterInfo>> entry : entrySet) {
      Set<Entry<String, IInterpreterInfo>> entrySet2 = entry.getValue().entrySet();
      for (Entry<String, IInterpreterInfo> entry2 : entrySet2) {
        String key = SynchSystemModulesManager.createKeyForInfo(entry2.getValue());
        preferences.setValue(key, "");
      }
    }
    if (preferences instanceof IPersistentPreferenceStore) {
      IPersistentPreferenceStore iPersistentPreferenceStore =
          (IPersistentPreferenceStore) preferences;
      try {
        iPersistentPreferenceStore.save();
      } catch (IOException e) {
        Log.log(e);
      }
    }

    // schedule changes to be executed.
    job.scheduleLater(0);
  }
  @Override
  protected void setUp() throws Exception {
    JobUtils.waitForIdle();
    IResource project =
        ResourcesPlugin.getWorkspace().getRoot().findMember("SeamWebWarTestProject");
    this.project = project.getProject();

    IPreferenceStore store = SeamCorePlugin.getDefault().getPreferenceStore();

    store.putValue(SeamPreferences.DUPLICATE_REMOVE, SeamPreferences.WARNING);
    store.putValue(SeamPreferences.DUPLICATE_DESTROY, SeamPreferences.WARNING);
    store.putValue(SeamPreferences.DUPLICATE_CREATE, SeamPreferences.WARNING);
    store.putValue(SeamPreferences.DUPLICATE_UNWRAP, SeamPreferences.WARNING);
    store.putValue(SeamPreferences.CREATE_DOESNT_BELONG_TO_COMPONENT, SeamPreferences.WARNING);
    store.putValue(SeamPreferences.UNWRAP_DOESNT_BELONG_TO_COMPONENT, SeamPreferences.WARNING);
    store.putValue(SeamPreferences.OBSERVER_DOESNT_BELONG_TO_COMPONENT, SeamPreferences.WARNING);
    store.putValue(SeamPreferences.NONUNIQUE_COMPONENT_NAME, SeamPreferences.WARNING);
    store.putValue(
        SeamPreferences.STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE, SeamPreferences.WARNING);
    store.putValue(
        SeamPreferences.STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY, SeamPreferences.WARNING);
    store.putValue(SeamPreferences.STATEFUL_COMPONENT_WRONG_SCOPE, SeamPreferences.WARNING);
    store.putValue(SeamPreferences.ENTITY_COMPONENT_WRONG_SCOPE, SeamPreferences.WARNING);
    store.putValue(SeamPreferences.UNKNOWN_COMPONENT_PROPERTY, SeamPreferences.WARNING);

    if (store instanceof IPersistentPreferenceStore) {
      try {
        ((IPersistentPreferenceStore) store).save();
      } catch (IOException e) {
        SeamCorePlugin.getPluginLog().logError(e);
      }
    }
  }
 private void handleSave(IPreferenceStore store) {
   if (store != null && store.needsSaving() && store instanceof IPersistentPreferenceStore) {
     try {
       ((IPersistentPreferenceStore) store).save();
     } catch (IOException e) {
       DartToolsPlugin.log(e);
     }
   }
 }
  private void saveProjectSettings(String wizardCmdOptions) {
    String workspaceOptions =
        SConsPlugin.getWorkspacePreferenceStore()
            .getString(PreferenceConstants.ADDITIONAL_COMMANDLINE_OPTIONS);

    if (wizardCmdOptions == null || workspaceOptions.equals(wizardCmdOptions)) return;

    // user has chosen his own SCons options and decided to take these
    // instead of workspace settings; therefore we store them in the
    // newly created project
    IPersistentPreferenceStore projectOptions = SConsPlugin.getProjectPreferenceStore(project);
    projectOptions.setValue(PreferenceConstants.ADDITIONAL_COMMANDLINE_OPTIONS, wizardCmdOptions);
    projectOptions.setValue(
        PreferenceConstants.BUILD_SETTINGS_PAGE_ID + PreferenceConstants.USE_PARENT_SUFFIX, false);
    try {
      projectOptions.save();
    } catch (Exception e) {
      // ignore because user then already has SCons settings
    }
  }
 @Override
 public void performApply() {
   try {
     fMDInstallRootDirEditor.store();
     IPath mdInstallRoot = new Path(fMDInstallRootDirEditor.getStringValue());
     JavaCore.setClasspathVariable(
         MDVariableInitializer.MD_CLASSPATH_VARIABLE, mdInstallRoot, new NullProgressMonitor());
     IPreferenceStore store = this.getPreferenceStore();
     ((IPersistentPreferenceStore) store).save();
     hasApplied = true;
   } catch (IOException e) {
     Activator.log(IStatus.ERROR, "MDPreferencePage (save)", e);
   } catch (JavaModelException e) {
     Activator.log(IStatus.ERROR, "MDPreferencePage (save)", e);
   }
 }
Esempio n. 6
0
  public static void postInfoWithToggle(
      final String title,
      final String msg,
      final String toggleMessage,
      final boolean toggleState,
      final IPersistentPreferenceStore store,
      final String key) {

    if (store == null
        || key == null
        || store.getString(key).equals(MessageDialogWithToggle.NEVER)) {
      return;
    }

    Display.getDefault()
        .asyncExec(
            new Runnable() {

              public void run() {
                MessageDialogWithToggle dialog =
                    MessageDialogWithToggle.openInformation(
                        Display.getDefault().getActiveShell(),
                        title,
                        msg,
                        toggleMessage,
                        toggleState,
                        store,
                        key);

                try {
                  if (dialog.getToggleState()) {
                    store.setValue(key, MessageDialogWithToggle.NEVER);
                    store.save();
                  }
                } catch (IOException e) {
                }
              }
            });
  }