/*
     * (non-Javadoc)
     *
     * @see
     * org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter
     * #changeControlPressed(org.eclipse.jdt
     * .internal.ui.wizards.dialogfields.DialogField)
     */
    public void changeControlPressed(DialogField field) {
      final DirectoryDialog dialog = new DirectoryDialog(getShell());
      dialog.setMessage(NewWizardMessages.NewJavaProjectWizardPageOne_directory_message);
      String directoryName = fLocation.getText().trim();
      if (directoryName.length() == 0) {
        String prevLocation =
            JavaPlugin.getDefault().getDialogSettings().get(DIALOGSTORE_LAST_EXTERNAL_LOC);
        if (prevLocation != null) {
          directoryName = prevLocation;
        }
      }

      if (directoryName.length() > 0) {
        final File path = new File(directoryName);
        if (path.exists()) dialog.setFilterPath(directoryName);
      }
      final String selectedDirectory = dialog.open();
      if (selectedDirectory != null) {
        String oldDirectory = new Path(fLocation.getText().trim()).lastSegment();
        fLocation.setText(selectedDirectory);
        String lastSegment = new Path(selectedDirectory).lastSegment();
        if (lastSegment != null
            && (fNameGroup.getName().length() == 0 || fNameGroup.getName().equals(oldDirectory))) {
          fNameGroup.setName(lastSegment);
        }
        JavaPlugin.getDefault()
            .getDialogSettings()
            .put(DIALOGSTORE_LAST_EXTERNAL_LOC, selectedDirectory);
      }
    }
  /**
   * Evaluates a 'java' template in the context of a compilation unit
   *
   * @param template the template to be evaluated
   * @param compilationUnit the compilation unit in which to evaluate the template
   * @param position the position inside the compilation unit for which to evaluate the template
   * @return the evaluated template
   * @throws CoreException in case the template is of an unknown context type
   * @throws BadLocationException in case the position is invalid in the compilation unit
   * @throws TemplateException in case the evaluation fails
   */
  public static String evaluateTemplate(
      Template template, ICompilationUnit compilationUnit, int position)
      throws CoreException, BadLocationException, TemplateException {

    TemplateContextType contextType =
        JavaPlugin.getDefault()
            .getTemplateContextRegistry()
            .getContextType(template.getContextTypeId());
    if (!(contextType instanceof CompilationUnitContextType))
      throw new CoreException(
          new Status(
              IStatus.ERROR,
              JavaUI.ID_PLUGIN,
              IStatus.ERROR,
              JavaTemplateMessages.JavaContext_error_message,
              null));

    IDocument document = new Document();
    if (compilationUnit != null && compilationUnit.exists())
      document.set(compilationUnit.getSource());

    CompilationUnitContext context =
        ((CompilationUnitContextType) contextType)
            .createContext(document, position, 0, compilationUnit);
    context.setForceEvaluation(true);

    TemplateBuffer buffer = context.evaluate(template);
    if (buffer == null) return null;
    return buffer.getString();
  }
  private void storeSelectionValue(ComboDialogField combo, String preferenceKey) {
    int index = combo.getSelectionIndex();
    if (index == -1) return;

    String item = combo.getItems()[index];
    JavaPlugin.getDefault().getDialogSettings().put(preferenceKey, item);
  }
  /**
   * @param input the editor input
   * @param offset the offset in the file
   * @return the element at the given offset
   */
  protected IJavaElement getElementAt(IEditorInput input, int offset) {
    if (input instanceof IClassFileEditorInput) {
      try {
        return ((IClassFileEditorInput) input).getClassFile().getElementAt(offset);
      } catch (JavaModelException ex) {
        return null;
      }
    }

    IWorkingCopyManager manager = JavaPlugin.getDefault().getWorkingCopyManager();
    ICompilationUnit unit = manager.getWorkingCopy(input);
    if (unit != null)
      try {
        if (unit.isConsistent()) return unit.getElementAt(offset);
        else {
          /*
           * XXX: We should set the selection later when the
           *      CU is reconciled.
           *      see https://bugs.eclipse.org/bugs/show_bug.cgi?id=51290
           */
        }
      } catch (JavaModelException ex) {
        // fall through
      }
    return null;
  }
 public WorkingSetGroup() {
   String[] workingSetIds = new String[] {IWorkingSetIDs_JAVA, IWorkingSetIDs_RESOURCE};
   fWorkingSetBlock =
       new WorkingSetConfigurationBlock(
           workingSetIds, JavaPlugin.getDefault().getDialogSettings());
   // fWorkingSetBlock.setDialogMessage(NewWizardMessages.NewJavaProjectWizardPageOne_WorkingSetSelection_message);
 }
  /**
   * Remembers the selection in the content assist history.
   *
   * @throws JavaModelException if anything goes wrong
   * @since 3.2
   */
  protected final void rememberSelection() throws JavaModelException {
    IType lhs = fInvocationContext.getExpectedType();
    IType rhs = (IType) getJavaElement();
    if (lhs != null && rhs != null)
      JavaPlugin.getDefault().getContentAssistHistory().remember(lhs, rhs);

    QualifiedTypeNameHistory.remember(getQualifiedTypeName());
  }
  public CodeTemplatePreferencePage() {
    setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore());
    // setDescription(PreferencesMessages.getString("CodeTemplatesPreferencePage.description"));
    // //$NON-NLS-1$

    // only used when page is shown programatically
    setTitle(PreferencesMessages.CodeTemplatesPreferencePage_title);
  }
 public LogicalPackagesProvider(StructuredViewer viewer) {
   fViewer = viewer;
   fCompoundState = isInCompoundState();
   fInputIsProject = true;
   fMapToLogicalPackage = new HashMap();
   fMapToPackageFragments = new HashMap();
   JavaPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
 }
 private int getLastSelectedJREKind() {
   int kind = PROJECT_RE;
   IDialogSettings settings = JavaPlugin.getDefault().getDialogSettings();
   if (settings.get(LAST_SELECTED_JRE_KIND2_KEY) != null) {
     kind = settings.getInt(LAST_SELECTED_JRE_KIND2_KEY);
   }
   return kind;
 }
 private static void updateFrom1To2(Map settings) {
   CleanUpOptions defaultSettings =
       JavaPlugin.getDefault()
           .getCleanUpRegistry()
           .getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS);
   settings.put(
       CleanUpConstants.ORGANIZE_IMPORTS,
       defaultSettings.getValue(CleanUpConstants.ORGANIZE_IMPORTS));
 }
 public NewProjectWizard(
     NewJavaProjectWizardPageOne pageOne, NewJavaProjectWizardPageTwo pageTwo) {
   setDefaultPageImageDescriptor(
       CeylonPlugin.getInstance().getImageRegistry().getDescriptor(CEYLON_NEW_FILE));
   setDialogSettings(JavaPlugin.getDefault().getDialogSettings());
   setWindowTitle("New Ceylon Project");
   fFirstPage = pageOne;
   fSecondPage = pageTwo;
 }
    private void createSignaturePreview(Composite composite) {
      Label previewLabel = new Label(composite, SWT.NONE);
      previewLabel.setText(RefactoringMessages.ChangeSignatureInputPage_method_Signature_Preview);

      //			//XXX: use ViewForm to draw a flat border. Beware of common problems with wrapping
      // layouts
      //			//inside GridLayout. GridData must be constrained to force wrapping. See bug 9866 et al.
      //			ViewForm border= new ViewForm(composite, SWT.BORDER | SWT.FLAT);

      IPreferenceStore store = JavaPlugin.getDefault().getCombinedPreferenceStore();
      fSignaturePreview =
          new JavaSourceViewer(
              composite,
              null,
              null,
              false,
              SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP /*| SWT.BORDER*/,
              store);
      fSignaturePreview.configure(
          new JavaSourceViewerConfiguration(
              JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null));
      fSignaturePreview
          .getTextWidget()
          .setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
      fSignaturePreview.adaptBackgroundColor(composite);
      fSignaturePreview.setDocument(fSignaturePreviewDocument);
      fSignaturePreview.setEditable(false);

      // Layouting problems with wrapped text: see
      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=9866
      Control signaturePreviewControl = fSignaturePreview.getControl();
      PixelConverter pixelConverter = new PixelConverter(signaturePreviewControl);
      GridData gdata = new GridData(GridData.FILL_BOTH);
      gdata.widthHint = pixelConverter.convertWidthInCharsToPixels(50);
      gdata.heightHint = pixelConverter.convertHeightInCharsToPixels(2);
      signaturePreviewControl.setLayoutData(gdata);

      //			//XXX must force JavaSourceViewer text widget to wrap:
      //			border.setContent(signaturePreviewControl);
      //			GridData borderData= new GridData(GridData.FILL_BOTH);
      //			borderData.widthHint= gdata.widthHint;
      //			borderData.heightHint= gdata.heightHint;
      //			border.setLayoutData(borderData);
    }
  /** Constructor for ClasspathVariablesPreferencePage */
  public ClasspathVariablesPreferencePage() {
    setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore());
    fVariableBlock = new VariableBlock(true, null);
    fStoredSettings = null;

    // title only used when page is shown programatically
    setTitle(PreferencesMessages.ClasspathVariablesPreferencePage_title);
    setDescription(PreferencesMessages.ClasspathVariablesPreferencePage_description);
    noDefaultAndApplyButton();
  }
 @SuppressWarnings("restriction")
 private void configureRefactoringDialogSettingsToRenameVariables() {
   IDialogSettings javaSettings = JavaPlugin.getDefault().getDialogSettings();
   IDialogSettings refactoringSettings =
       javaSettings.getSection(RefactoringWizardPage.REFACTORING_SETTINGS);
   if (refactoringSettings == null) return;
   refactoringSettings.put(RenameRefactoringWizard.TYPE_UPDATE_SIMILAR_ELEMENTS, true);
   refactoringSettings.put(
       RenameRefactoringWizard.TYPE_SIMILAR_MATCH_STRATEGY,
       RenamingNameSuggestor.STRATEGY_EMBEDDED);
 }
 /*
  * @see junit.framework.TestCase#setUp()
  * @since 3.1
  */
 protected void setUp() throws Exception {
   JavaPlugin.getDefault()
       .getPreferenceStore()
       .setValue(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
   fEditor =
       openJavaEditor(
           new Path(
               "/"
                   + JUnitProjectTestSetup.getProject().getElementName()
                   + "/src/junit/framework/TestCase.java"));
   assertNotNull(fEditor);
 }
  private IWizardPage[] openNewElementWizard(
      IWorkbenchWizard wizard, Shell shell, Object selection) {
    wizard.init(JavaPlugin.getDefault().getWorkbench(), new StructuredSelection(selection));

    WizardDialog dialog = new WizardDialog(shell, wizard);
    PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(
        converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
    dialog.create();
    dialog.open();
    IWizardPage[] pages = wizard.getPages();
    return pages;
  }
  public JavaSelectAnnotationRulerAction(
      ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler) {
    super(bundle, prefix, editor, ruler);
    fBundle = bundle;
    fTextEditor = editor;

    fAnnotationPreferenceLookup = EditorsUI.getAnnotationPreferenceLookup();
    fStore = JavaPlugin.getDefault().getCombinedPreferenceStore();

    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(this, IJavaHelpContextIds.JAVA_SELECT_MARKER_RULER_ACTION);
  }
public class CleanUpProfileManager extends ProfileManager {

  public static KeySet[] KEY_SETS = {
    new KeySet(
        JavaUI.ID_PLUGIN,
        new ArrayList<>(
            JavaPlugin.getDefault()
                .getCleanUpRegistry()
                .getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS)
                .getKeys()))
  };

  private final PreferencesAccess fPreferencesAccess;

  public CleanUpProfileManager(
      List<Profile> profiles,
      IScopeContext context,
      PreferencesAccess preferencesAccess,
      IProfileVersioner profileVersioner) {
    super(
        profiles,
        context,
        preferencesAccess,
        profileVersioner,
        KEY_SETS,
        CleanUpConstants.CLEANUP_PROFILE,
        CleanUpConstants.CLEANUP_SETTINGS_VERSION_KEY);
    fPreferencesAccess = preferencesAccess;
  }

  @Override
  public Profile getDefaultProfile() {
    return getProfile(CleanUpConstants.DEFAULT_PROFILE);
  }

  @Override
  protected void updateProfilesWithName(String oldName, Profile newProfile, boolean applySettings) {
    super.updateProfilesWithName(oldName, newProfile, applySettings);

    IEclipsePreferences node = fPreferencesAccess.getInstanceScope().getNode(JavaUI.ID_PLUGIN);
    String name = node.get(CleanUpConstants.CLEANUP_ON_SAVE_PROFILE, null);
    if (name != null && name.equals(oldName)) {
      if (newProfile == null) {
        node.remove(CleanUpConstants.CLEANUP_ON_SAVE_PROFILE);
      } else {
        node.put(CleanUpConstants.CLEANUP_ON_SAVE_PROFILE, newProfile.getID());
      }
    }
  }
}
  /**
   * Returns <code>true</code> if imports may be added. The return value depends on the context and
   * preferences only and does not take into account the contents of the compilation unit or the
   * kind of proposal. Even if <code>true</code> is returned, there may be cases where no imports
   * are added for the proposal. For example:
   *
   * <ul>
   *   <li>when completing within the import section
   *   <li>when completing informal javadoc references (e.g. within <code>&lt;code&gt;</code> tags)
   *   <li>when completing a type that conflicts with an existing import
   *   <li>when completing an implicitly imported type (same package, <code>java.lang</code> types)
   * </ul>
   *
   * <p>The decision whether a qualified type or the simple type name should be inserted must take
   * into account these different scenarios.
   *
   * <p>Subclasses may extend.
   *
   * @return <code>true</code> if imports may be added, <code>false</code> if not
   */
  protected boolean allowAddingImports() {
    if (isInJavadoc()) {
      // TODO fix
      //			if (!fContext.isInJavadocFormalReference())
      //				return false;
      if (fProposal.getKind() == CompletionProposal.TYPE_REF
          && fInvocationContext.getCoreContext().isInJavadocText()) return false;

      if (!isJavadocProcessingEnabled()) return false;
    }

    IPreferenceStore preferenceStore = JavaPlugin.getDefault().getPreferenceStore();
    return preferenceStore.getBoolean(PreferenceConstants.CODEASSIST_ADDIMPORT);
  }
  @Override
  protected void setUp() throws Exception {
    Hashtable<String, String> options = TestOptions.getDefaultOptions();
    options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
    options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
    JavaCore.setOptions(options);

    IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
    store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);

    fJProject1 = ProjectTestSetup.getProject();

    fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
  }
Exemple #21
0
  private void registerTemplateVariableResolvers() {
    if (hasJavaPlugin()) {
      final ContextTypeRegistry codeTemplateContextRegistry =
          JavaPlugin.getDefault().getCodeTemplateContextRegistry();
      final Iterator<?> ctIter = codeTemplateContextRegistry.contextTypes();

      while (ctIter.hasNext()) {
        final TemplateContextType contextType = (TemplateContextType) ctIter.next();
        contextType.addResolver(
            new GitTemplateVariableResolver(
                "git_config", //$NON-NLS-1$
                UIText.GitTemplateVariableResolver_GitConfigDescription));
      }
    }
  }
Exemple #22
0
  /**
   * 將所要變更的內容寫回Edit中 (New)
   *
   * @param msg
   */
  protected void applyChange(ASTRewrite rewrite) {
    try {
      // 參考org.eclipse.jdt.internal.ui.text.correction.CorrectionMarkerResolutionGenerator run
      // org.eclipse.jdt.internal.ui.text.correction.ChangeCorrectionProposal apply與performChange
      ICompilationUnit cu = (ICompilationUnit) actOpenable;
      IEditorPart part = EditorUtility.isOpenInEditor(cu);
      IEditorInput input = part.getEditorInput();
      IDocument doc =
          JavaPlugin.getDefault().getCompilationUnitDocumentProvider().getDocument(input);

      performChange(JavaPlugin.getActivePage().getActiveEditor(), doc, rewrite);
    } catch (CoreException e) {
      logger.error("[Core Exception] EXCEPTION ", e);
    }
  }
Exemple #23
0
  public GroovyEditor() {
    super();

    setPreferenceStore(
        new ChainedPreferenceStore(
            new IPreferenceStore[] {
              getPreferenceStore(),
              JavaPlugin.getDefault().getPreferenceStore(),
              GroovyPlugin.getDefault().getPreferenceStore()
            }));

    colorManager = new ColorManager();
    GroovyConfiguration groovyConfiguration = new GroovyConfiguration(colorManager);
    groovyConfiguration.setEditor(this);
    setSourceViewerConfiguration(groovyConfiguration);
  }
  private void installCodeColoring() {
    if (fCodeColorManager == null && getSourceViewer() != null) {

      ColoredSourceFile source = getSourceFile();
      assert source.isColored();
      JDTColorManagerBridge colorManager = new JDTColorManagerBridge(source);

      fCodeColorManager = new ColoredHighlightingManager();
      fCodeColorManager.install(
          this,
          (JavaSourceViewer) getSourceViewer(),
          JavaPlugin.getDefault().getJavaTextTools().getColorManager(),
          getPreferenceStore(),
          colorManager);
    }
    if (fCodeColorManager != null) fCodeColorManager.fReconciler.scheduleJob();
  }
  /*
   * @see TemplateContext#evaluate(Template template)
   */
  @Override
  public TemplateBuffer evaluate(Template template) throws BadLocationException, TemplateException {
    clear();

    if (!canEvaluate(template))
      throw new TemplateException(JavaTemplateMessages.Context_error_cannot_evaluate);

    TemplateTranslator translator =
        new TemplateTranslator() {
          @Override
          protected TemplateVariable createVariable(
              TemplateVariableType type, String name, int[] offsets) {
            //				TemplateVariableResolver resolver= getContextType().getResolver(type.getName());
            //				return resolver.createVariable();

            MultiVariable variable = new JavaVariable(type, name, offsets);
            fVariables.put(name, variable);
            return variable;
          }
        };
    TemplateBuffer buffer = translator.translate(template);

    getContextType().resolve(buffer, this);

    rewriteImports();

    IPreferenceStore prefs = JavaPlugin.getDefault().getPreferenceStore();
    boolean useCodeFormatter = prefs.getBoolean(PreferenceConstants.TEMPLATES_USE_CODEFORMATTER);

    IJavaProject project = getJavaProject();
    JavaFormatter formatter =
        new JavaFormatter(
            TextUtilities.getDefaultLineDelimiter(getDocument()),
            getIndentation(),
            useCodeFormatter,
            project);
    formatter.format(buffer, this);

    clear();

    return buffer;
  }
  @Override
  protected void setUp() throws Exception {
    Hashtable<String, String> options = TestOptions.getDefaultOptions();
    options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
    options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
    options.put(
        DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE,
        JavaCore.DO_NOT_INSERT);

    JavaCore.setOptions(options);

    IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
    store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);

    fJProject1 = Java18ProjectTestSetup.getProject();

    StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "", null);
    StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORSTUB_ID, "", null);

    fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
  }
  public static void getRemoveJavadocTagProposals(
      IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
    ASTNode node = problem.getCoveringNode(context.getASTRoot());
    while (node != null && !(node instanceof TagElement)) {
      node = node.getParent();
    }
    if (node == null) {
      return;
    }
    ASTRewrite rewrite = ASTRewrite.create(node.getAST());
    rewrite.remove(node, null);

    String label = CorrectionMessages.JavadocTagsSubProcessor_removetag_description;
    Image image =
        JavaPlugin.getDefault()
            .getWorkbench()
            .getSharedImages()
            .getImage(ISharedImages.IMG_TOOL_DELETE);
    proposals.add(
        new ASTRewriteCorrectionProposal(
            label, context.getCompilationUnit(), rewrite, IProposalRelevance.REMOVE_TAG, image));
  }
 protected void warnAboutTypeCommentDeprecation() {
   String key = IUIConstants.DIALOGSTORE_TYPECOMMENT_DEPRECATED;
   if (OptionalMessageDialog.isDialogEnabled(key)) {
     TemplateStore templates = JavaPlugin.getDefault().getTemplateStore();
     boolean isOldWorkspace =
         templates.findTemplate("filecomment") != null
             && templates.findTemplate("typecomment") != null; // $NON-NLS-1$ //$NON-NLS-2$
     if (!isOldWorkspace) {
       OptionalMessageDialog.setDialogEnabled(key, false);
     }
     String title = NewWizardMessages.NewElementWizard_typecomment_deprecated_title;
     String message = NewWizardMessages.NewElementWizard_typecomment_deprecated_message;
     OptionalMessageDialog.open(
         key,
         getShell(),
         title,
         null,
         message,
         MessageDialog.INFORMATION,
         new String[] {IDialogConstants.OK_LABEL},
         0);
   }
 }
  public SortMembersMessageDialog(Shell parentShell) {
    super(
        OPTIONAL_ID,
        parentShell,
        DialogsMessages.SortMembersMessageDialog_dialog_title,
        null,
        new String(),
        INFORMATION,
        new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
        0);

    fDialogSettings = JavaPlugin.getDefault().getDialogSettings();

    boolean isSortAll = fDialogSettings.getBoolean(DIALOG_SETTINGS_SORT_ALL);

    fNotSortAllRadio = new SelectionButtonDialogField(SWT.RADIO);
    fNotSortAllRadio.setLabelText(
        DialogsMessages.SortMembersMessageDialog_do_not_sort_fields_label);
    fNotSortAllRadio.setSelection(!isSortAll);

    fSortAllRadio = new SelectionButtonDialogField(SWT.RADIO);
    fSortAllRadio.setLabelText(DialogsMessages.SortMembersMessageDialog_sort_all_label);
    fSortAllRadio.setSelection(isSortAll);
  }
  private Map updateAndComplete(Map oldSettings, int version) {
    final Map newSettings =
        JavaPlugin.getDefault()
            .getCleanUpRegistry()
            .getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS)
            .getMap();

    switch (version) {
      case VERSION_1:
        updateFrom1To2(oldSettings);
        // $FALL-THROUGH$
      default:
        for (final Iterator iter = oldSettings.keySet().iterator(); iter.hasNext(); ) {
          final String key = (String) iter.next();
          if (!newSettings.containsKey(key)) continue;

          final String value = (String) oldSettings.get(key);
          if (value != null) {
            newSettings.put(key, value);
          }
        }
    }
    return newSettings;
  }