Skip to content
This repository has been archived by the owner on Jan 15, 2020. It is now read-only.

Add support for diagram markers #217

Closed
wants to merge 1 commit into from
Closed

Conversation

tortmayr
Copy link
Collaborator

From #216 :
Closes #30

This is an initial contribution for offering model validation support that shows validation info/warning/error messages as diagram decorators. I opened issues #213 and #214 for further improving this initial model validation support. I am happy to work on these issues if you think the suggested improvements make sense.


static readonly KIND = 'setMarkers';

markers: Marker[];
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this field?

*/
execute(context: CommandExecutionContext): CommandResult {
this.markers = this.action.markers;
for (let marker of this.markers) {
Copy link
Collaborator Author

@tortmayr tortmayr Mar 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be for (const marker ..., because the value is never reassigned.

return issueMarker;
}

private createSIssue(marker: Marker): SIssue {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't access any member variables so can be defined as function


undo(context: CommandExecutionContext): CommandResult {
this.markers = this.action.markers;
for (let marker of this.markers) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be for (const marker

for (let marker of this.markers) {
const modelElement: SModelElement | undefined = context.root.index.getById(marker.elementId);
if (modelElement instanceof SParentElement) {
for (let child of modelElement.children) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be for (const child

getMarkers(): Marker[] {
return this.markers;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove blank line

return this.execute(context);
}

getMarkers(): Marker[] {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need that getter? this.markers is public anyways

markers.addAll(validator.validate(modelState, modelElement));
}

// TODO get element ID of root element on client side and send it (see
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the TODOs are outdated.

* Defines kinds of model markers
*
*/
public class MarkerKind {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be final

Copy link
Collaborator Author

@tortmayr tortmayr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tanjaem Thanks a lot! Works great and I only found a few minor issues/nitpicks.

Maybe the markers should be hoverable so that we can provide additional information (e.g. description) via Popup. But this can be handled in a follow-up PR

@tanjaem
Copy link
Contributor

tanjaem commented Mar 17, 2019

Thanks for your feedback! Should all be incorporated now.

@tortmayr tortmayr closed this Mar 18, 2019
@tortmayr tortmayr deleted the tanjaem/issues/30 branch April 3, 2019 08:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants