0

I am writing a plugin which needs to retrieve the tab size setting of eclipse.

That is the 'Windows > Preferences > General > Editor > Text Editors > Displayed tab width' setting

Does anyone have any idea how to achieve this? Thank for your help.

greg-449
  • 109,219
  • 232
  • 102
  • 145
zqzwxec
  • 51
  • 4

1 Answers1

0

If your code is in a text editor extending TextEditor you can get the tab setting from the source viewer configuration using:

getSourceViewerConfiguration().getTabWidth(getSourceViewer());

elsewhere you could use:

IPreferenceStore store = EditorsUI.getPreferenceStore();

store.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH));
greg-449
  • 109,219
  • 232
  • 102
  • 145