Skip to content

Commit

Permalink
Update min chars of view tab titles when show full title pref is checked
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamWaghmare-sap authored and BeckerWdf committed Mar 8, 2024
1 parent 5bd3301 commit 26df6c6
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
Expand Down Expand Up @@ -1306,10 +1305,9 @@ private void showFullTextForViewTabsPreferenceChanged() {
boolean showFullText = getShowFullTextForViewTabsPreference();
if (!isPartOfEditorStack()) {
if (showFullText) {
Optional<Integer> lengthOfLongestItemText = Arrays.stream(parent.getItems()).map(CTabItem::getText)
.map(String::length)
.max(Integer::compare);
parent.setMinimumCharacters(lengthOfLongestItemText.orElseGet(() -> MAX_VIEW_CHARS));
int lengthOfLongestItemText = Arrays.stream(parent.getItems()).map(CTabItem::getText)
.map(String::length).max(Integer::compare).orElse(0);
parent.setMinimumCharacters(Math.max(MAX_VIEW_CHARS, lengthOfLongestItemText));
} else {
parent.setMinimumCharacters(MIN_VIEW_CHARS);
}
Expand Down

0 comments on commit 26df6c6

Please sign in to comment.