1
0
mirror of https://github.com/octoleo/plantuml.git synced 2025-04-06 18:21:52 +00:00

Merge commit '89406657e7a26c74119a87637f8f96c94055b45b' into patch/1580

This commit is contained in:
Dietrich Travkin 2023-10-30 10:45:34 +01:00
commit 7a7f59f00b
2 changed files with 44 additions and 21 deletions

View File

@ -85,6 +85,11 @@ public class EntityGenderUtils {
public String getGender() { public String getGender() {
return stereotype; return stereotype;
} }
@Override
public String getGender() {
return stereotype;
}
}; };
} }
@ -163,4 +168,17 @@ public class EntityGenderUtils {
}; };
} }
static public EntityGender byClassName(String className) {
return new EntityGender() {
@Override
public boolean contains(Entity test) {
return className.equals(test.getName());
}
@Override
public String getGender() {
return className;
}
};
}
} }

View File

@ -190,18 +190,24 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
} else { } else {
arg1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1); arg1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1);
final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(arg1)); final Quark<Entity> quark = diagram.quarkInContext(true, diagram.cleanId(arg1));
if (quark == null) {
return CommandExecutionResult.error("No such quark " + arg1);
}
if (portion == EntityPortion.METHOD) {
gender = EntityGenderUtils.byClassName(arg1);
} else {
Entity entity = quark.getData(); Entity entity = quark.getData();
if (entity == null) if (entity == null)
return CommandExecutionResult.error("No such element " + quark.getName()); return CommandExecutionResult.error("No such element " + quark.getName());
gender = EntityGenderUtils.byEntityAlone(entity); gender = EntityGenderUtils.byEntityAlone(entity);
} }
if (gender != null) { }
final boolean empty = arg.get("EMPTY", 0) != null; final boolean empty = arg.get("EMPTY", 0) != null;
final boolean emptyMembers = empty && portion == EntityPortion.MEMBER; final boolean emptyMembers = empty && portion == EntityPortion.MEMBER;
if (empty == true && emptyMembers == false) if (empty && !emptyMembers)
gender = EntityGenderUtils.and(gender, emptyByGender(portion)); gender = EntityGenderUtils.and(gender, emptyByGender(portion));
if (diagram.getCurrentGroup().isRoot() == false) if (!diagram.getCurrentGroup().isRoot())
gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup())); gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup()));
if (emptyMembers) { if (emptyMembers) {
@ -212,7 +218,6 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
} else { } else {
diagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show")); diagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
} }
}
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }