Skip to content

Commit

Permalink
Fix the "No enum constant SplitEditorLayout.SHOW_PREVIEW" error that …
Browse files Browse the repository at this point in the history
…user reported
  • Loading branch information
whimet committed Apr 19, 2024
1 parent 33bcf69 commit 3af8d48
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -201,7 +202,7 @@ public void setState(@NotNull FileEditorState state) {
if (compositeState.getSecondState() != null) {
mySecondEditor.setState(compositeState.getSecondState());
}
if (compositeState.getSplitLayout() != null) {
if (compositeState.getSplitLayout() != null && SplitEditorLayout.isValid(compositeState.getSplitLayout())) {
mySplitEditorLayout = SplitEditorLayout.valueOf(compositeState.getSplitLayout());
invalidateLayout(true);
}
Expand Down Expand Up @@ -380,6 +381,10 @@ public String getPresentationText() {
return StringUtil.capitalize(StringUtil.substringAfter(presentationName, "Show "));
}

public static boolean isValid(String value) {
return Arrays.stream(values()).anyMatch(e -> e.name().equals(value));
}

@Override
public String toString() {
return presentationName;
Expand Down

0 comments on commit 3af8d48

Please sign in to comment.