MCPcopy Create free account
hub / github.com/FabricMC/Matcher / updateMatchButtons

Method updateMatchButtons

src/main/java/matcher/gui/BottomPane.java:100–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98 }
99
100 private void updateMatchButtons() {
101 ClassInstance clsA = srcPane.getSelectedClass();
102 ClassInstance clsB = dstPane.getSelectedClass();
103
104 MemberInstance<?> memberA = srcPane.getSelectedMethod();
105 if (memberA == null) memberA = srcPane.getSelectedField();
106 MemberInstance<?> memberB = dstPane.getSelectedMethod();
107 if (memberB == null) memberB = dstPane.getSelectedField();
108
109 MethodVarInstance varA = srcPane.getSelectedMethodVar();
110 MethodVarInstance varB = dstPane.getSelectedMethodVar();
111
112 matchButton.setDisable(!canMatchClasses(clsA, clsB) && !canMatchMembers(memberA, memberB) && !canMatchVars(varA, varB));
113 /*
114 * class-null class-matchable class-matched member-null member-matchable member-matched var-null var-matchable var-matched disabled text target
115 * 1 x x x x x x x x 1 unmatchable -
116 * 0 0 x x x x x x x 0 matchable cls
117 * 0 1 0 x x x x x x 0 unmatchable cls
118 * 0 1 1 1 x x x x x 1 unmatchable -
119 * 0 1 1 0 0 x x x x 0 matchable member
120 * 0 1 1 0 1 0 x x x 0 unmatchable member
121 * 0 1 1 0 1 1 1 x x 1 unmatchable -
122 * 0 1 1 0 1 1 0 0 x 0 matchable var
123 * 0 1 1 0 1 1 0 1 0 0 unmatchable var
124 * 0 1 1 0 1 1 0 1 1 1 unmatchable -
125 */
126 matchableButton.setDisable(clsA == null || clsA.isMatchable() && (clsA.hasMatch() || !clsA.hasPotentialMatch())
127 && (memberA == null || memberA.isMatchable() && (memberA.hasMatch() || !memberA.hasPotentialMatch())
128 && (varA == null || varA.isMatchable() && (varA.hasMatch() || !varA.hasPotentialMatch()))));
129 matchableButton.setText(clsA != null && (!clsA.isMatchable()
130 || memberA != null && (!memberA.isMatchable()
131 || varA != null && !varA.isMatchable())) ? "matchable" : "unmatchable");
132 unmatchClassButton.setDisable(!canUnmatchClass(clsA));
133 unmatchMemberButton.setDisable(!canUnmatchMember(memberA));
134 unmatchVarButton.setDisable(!canUnmatchVar(varA));
135
136 matchPerfectMembersButton.setDisable(!canMatchPerfectMembers(clsA));
137 }
138
139 // match / unmatch actions implementation
140

Callers 6

onMatchChangeMethod · 0.95
onClassSelectMethod · 0.80
onMethodSelectMethod · 0.80
onFieldSelectMethod · 0.80
onMethodVarSelectMethod · 0.80
onMatchListRefreshMethod · 0.80

Calls 15

canMatchClassesMethod · 0.95
canMatchMembersMethod · 0.95
canMatchVarsMethod · 0.95
isMatchableMethod · 0.95
hasPotentialMatchMethod · 0.95
isMatchableMethod · 0.95
hasPotentialMatchMethod · 0.95
canUnmatchClassMethod · 0.95
canUnmatchMemberMethod · 0.95
canUnmatchVarMethod · 0.95
hasMatchMethod · 0.80

Tested by

no test coverage detected