Search code examples
javaeclipsercp

change the number of opened editors before closing value


For my eclipse rcp application, I tried to change the "Number of opened editors before closing" programatically by modifying the extension point org.eclipse.ui.editors :

 IPreferenceStore prefs = getPreferenceStore(); 
 prefs.setValue("org.eclipse.editorss.maxEditorTabs",15) ;
((IPersistentPreferenceStore) prefs).save() ;

https://i.sstatic.net/G5rS0.png

but it doesn't work, so I tried to use IWorkbenchPreferenceConstants.MAX_EDITORS_FROM_MODEL but I guess it's not available in the latest version of Eclipse anymore.

so my question is can i change this value or not ?


Solution

  • The "Number of opened editors before closing" preference id is the REUSE_EDITORS constant in org.eclipse.ui.internal.IPreferenceConstants.

    The preference must be set in the WorkbenchPlugin.getDefault().getPreferenceStore() preference store.

    Note that both IPreferenceConstants and WorkbenchPlugin are internal so really should not be used.

    See org.eclipse.ui.internal.ide.dialogs.IDEEditorsPreferencePage for more details.