private int getHistoryMaxEntries() {
    InteractiveConsolePlugin plugin = InteractiveConsolePlugin.getDefault();
    int historyMaxEntries;
    if (plugin != null) {
      IPreferenceStore store = plugin.getPreferenceStore();
      historyMaxEntries =
          store.getInt(
              ScriptConsoleUIConstants.INTERACTIVE_CONSOLE_PERSISTENT_HISTORY_MAXIMUM_ENTRIES);
    } else {
      historyMaxEntries =
          ScriptConsoleUIConstants.DEFAULT_INTERACTIVE_CONSOLE_PERSISTENT_HISTORY_MAXIMUM_ENTRIES;
    }

    if (historyMaxEntries < 0) {
      historyMaxEntries = 0;
    }

    return historyMaxEntries;
  }